diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-04 11:09:39 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-04 11:09:39 +0000 |
commit | e305c764722394c18d55e084c7be4b64ff799fa4 (patch) | |
tree | 24f9dd8cc6f5393a9084d8149e53af5e850b25e7 /src/util/service.c | |
parent | ba59bf06eefaefa447fbca9059adefe9ac0ef167 (diff) | |
download | gnunet-e305c764722394c18d55e084c7be4b64ff799fa4.tar.gz gnunet-e305c764722394c18d55e084c7be4b64ff799fa4.zip |
LRN's big logging rewrite (#1805):
* GNUNET_BOTTOM_LOGLEVEL and GNUNET_TOP_LOGLEVEL set global levels
Use bottom level to force logging to be more verbose than configured
Use top level to force logging to be less verbose than configured
Obviously, bottom <= top
* GNUNET_LOG sets per-component levels
GNUNET_LOG looks like this:
name[/bottom[/top]]/...
name starts with a non-digit character, must not include '/'
bottom and top must consist only of digits, or be empty
a description is only used if it matches the component exactly
as a special exception (for now) the name '*' matches any component
per-component loglevels override global loglevels
global levels override whatever is given via arguments or in config
Examples:
test_client/8/8/
run test_client with DEBUG level (usually leads to a timeout, by the way)
*/2/2/core/8/8/transport/4/4
run everything with WARNING, core - with DEBUG, transport - with INFO
*//1/peerinfo/4/
run everything with top loglevel ERROR, global/configured bottom loglevel,
and peerinfo - with bottom loglevel INFO and global/configured top loglevel
statistics/
does nothing
* Added GNUNET_ERROR_TYPE_UNSPECIFIED enum value, to hold -1.
Its corresponding string is NULL.
* Changed the logger calls as Grothoff suggested - to use static int to hold
the result of runtime evaluation of logability.
Logging can be unconditionally disabled in advance by defining
GNUNET_LOG_CALL_STATUS to 0, and enabled in advance by defining it to 1.
* Added GNUNET_CULL_LOGGING, which, if defined, completely culls out all
logging calls at compile time.
* Log definition parsing is only done once, results are cached.
* Changed definition format, now it looks like this:
[component|*|];[file|*|];[function|*|];[from_line[-to_line]];level/[component...]
All field separators are mandatory (but some fields could be empty or be '*').
Line definition must be either empty or "number" or "number-number"
Level definition must not be empty, and is a string representation
of the level (i.e. DEBUG, WARNING, INFO, etc).
Definition entry must end with a slash, whether or not there's another
entry after it.
File name is matched to the end of __FILE__, which allows file name
to match not only the base name, but also directories leading to it.
* Removed default WARNING loglevel from program and service utility code.
Now they default to NULL (UNSPECIFIED) level, which can be overriden by
GNUNET_LOG definition, if no level is specified via config or commandline.
Log levels from config or commandline are overriden by GNUNET_FORCE_LOG.
If GNUNET_*LOG are undefined, and no levels came from config or commandline,
logger internally defaults to WARNING level.
Add --enable-logging configure option
Diffstat (limited to 'src/util/service.c')
-rw-r--r-- | src/util/service.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util/service.c b/src/util/service.c index dc6a7330e..ad74d2786 100644 --- a/src/util/service.c +++ b/src/util/service.c | |||
@@ -1542,7 +1542,7 @@ GNUNET_SERVICE_run (int argc, char *const *argv, const char *serviceName, | |||
1542 | err = 1; | 1542 | err = 1; |
1543 | do_daemonize = 0; | 1543 | do_daemonize = 0; |
1544 | logfile = NULL; | 1544 | logfile = NULL; |
1545 | loglev = GNUNET_strdup ("WARNING"); | 1545 | loglev = NULL; |
1546 | cfg_fn = GNUNET_strdup (GNUNET_DEFAULT_USER_CONFIG_FILE); | 1546 | cfg_fn = GNUNET_strdup (GNUNET_DEFAULT_USER_CONFIG_FILE); |
1547 | memset (&sctx, 0, sizeof (sctx)); | 1547 | memset (&sctx, 0, sizeof (sctx)); |
1548 | sctx.options = opt; | 1548 | sctx.options = opt; |
@@ -1611,7 +1611,7 @@ shutdown: | |||
1611 | GNUNET_free_non_null (sctx.addrs); | 1611 | GNUNET_free_non_null (sctx.addrs); |
1612 | GNUNET_free_non_null (sctx.addrlens); | 1612 | GNUNET_free_non_null (sctx.addrlens); |
1613 | GNUNET_free_non_null (logfile); | 1613 | GNUNET_free_non_null (logfile); |
1614 | GNUNET_free (loglev); | 1614 | GNUNET_free_non_null (loglev); |
1615 | GNUNET_free (cfg_fn); | 1615 | GNUNET_free (cfg_fn); |
1616 | GNUNET_free_non_null (sctx.v4_denied); | 1616 | GNUNET_free_non_null (sctx.v4_denied); |
1617 | GNUNET_free_non_null (sctx.v6_denied); | 1617 | GNUNET_free_non_null (sctx.v6_denied); |