Commit Graph

7 Commits

Author SHA1 Message Date
Andrew Bettison
2333a116f3 Fix a bug in debug hexdumps
Introduced in the recent log system overhaul.
2018-03-09 16:56:36 +10:30
Andrew Bettison
92fa6c196a Rewrite logging system
Rename the logging primitive functions and utility functions, prefixing
all with 'serval_log', eg: logMessage() -> serval_logf() etc.

Add an XPRINTF xhexdump() function and use it to implement the
serval_log_hexdump() utility, renamed from dump().  Add macros
WHY_dump(), WARN_dump(), HINT_dump() and DEBUG_dump(), and use them
everywhere.

Remove the 'log.console.dump_config' and 'log.file.dump_config'
configuration options; configuration is now dumped in every log prolog.

The logging system now constructs the log prolog by invoking the new
'log_prolog' trigger, so that it no longer depends on the version string
and configuration system.  Any system that wants to present a message in
the log prolog can define its own trigger, which calls standard log
primitives to print the message.

Split the logging system into a front-end (log.c) that provides the
logging primitives and is independent of the configuration system, and a
set of back-end "outputters" (log_output_console.c, log_output_file.c,
log_output_android.c) that may depend on the configuration system and
are decoupled from the front-end using the 'logoutput' link section.

These log outputters are explicitly linked into executables by the
Makefile rules, but could also be linked in using USE_FEATURE().  The
USE_FEATURE() calls have _not_ been added to servald_features.c, so that
different daemon executables can be built with the same feature set but
different log outputs.
2018-03-06 15:16:56 +10:30
Andrew Bettison
a060642fdb Add strbuf_local_buf() macro 2015-11-02 10:11:41 +10:30
Jeremy Lakeman
7bc253e844 Refactor source and build process to split out test commands 2014-12-01 13:26:27 +10:30
Andrew Bettison
cd9f35f1c8 Improve "log.h", make logMessage() inline
Make logMessage() -- wrapper around vlogMessage() -- an inline
function and remove redundant conditional level != LOG_LEVEL_SILENT

Move logString() into log_util.c, refactor so outer loop now iterates
over lines in buffer, rather than over all log outputs

Rename log_backtrace() to logBacktrace() for consistency

Document __NOWHENCE__ value
2014-05-05 18:17:51 +09:30
Jeremy Lakeman
6a330977f3 Refactor and move logArgv() to log_util.c 2014-05-02 13:45:31 +09:30
Andrew Bettison
92253ca97d Revive config_test.c
Move config-dependent code (recvwithttl) from net.c to mdp_net.c (new)

Move log-implementation-independent code from log.c to log_util.c (new)

Build config_test binary in Makefile
2013-11-21 16:05:17 +10:30