json-util: fine tune json_dispatch_log_level()
Let's give the user control on how to handle JSON "null" assignments of the log level. As one of three cases: as failure, as LOG_NULL (i.e. to turn off logging) or as LOG_INFO (as our usual default log level). Let's then use that in the generic SetLogLevel() call, so that callers can use it to explicitly turn off logging in a service. Note that this was (probably accidentally) already implemented, except that the introspection enforcement blocked it. Let's clean this up and make this officially a thing, since it's generally useful to turn off logging I think.
This commit is contained in:
@@ -34,6 +34,7 @@ typedef enum LogTarget{
|
||||
/* This log level disables logging completely. It can only be passed to log_set_max_level() and cannot be
|
||||
* used as a regular log level. */
|
||||
#define LOG_NULL (LOG_EMERG - 1)
|
||||
assert_cc(LOG_NULL == -1);
|
||||
|
||||
#define SYNTHETIC_ERRNO(num) (abs(num) | (1 << 30))
|
||||
#define IS_SYNTHETIC_ERRNO(val) (((val) >> 30) == 1)
|
||||
|
||||
Reference in New Issue
Block a user