Commit Graph

9 Commits

Author SHA1 Message Date
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
Jeremy Lakeman
1e70bcaac6 Clean up some more warnings 2016-11-21 10:34:12 +10:30
Andrew Bettison
6dd823a9e8 Rename "features.h" to "lang.h"
In preparation for introducing "feature.h" for feature-driven linking.
2016-10-19 09:30:18 +10:30
Andrew Bettison
e8e87b8a34 Fix broken clang and Android builds
Recent addition of the GCC __attribute__(alloc_size) to some functions
in mem.h broke the build when using Clang 3.5.  This commit introduces
configure-time checks for all GCC attributes used in the Serval source
code, and adapts accordingly.
2015-11-23 15:00:25 +10:30
Jeremy Lakeman
bcd9575b54 Fix minor compilation issues on CentOS.
- ensure size_t is defined when compiling xprintf.h
- declare overlay_route_record as a union field in overlay_route_record to avoid alignment issues
- set the result of fwrite and fputs
- support slightly older git version
2014-10-20 12:35:21 +10:30
Andrew Bettison
5226e47ef6 Uniform #ifdef __SERVAL_DNA__... for headers 2013-12-04 17:15:36 +10:30
Jeremy Lakeman
3be2ed615d Resurrect packet visualisation 2013-09-02 14:55:02 +09:30
Andrew Bettison
28a77abc18 Add XPRINT strbuf adapter 2013-03-25 12:02:48 +10:30
Andrew Bettison
03da89225d Add xprintf() extensible stream formatter
Use it to replace open_memstream(3) in logServalPacket() -- not available on
Mac OS X
2012-08-03 16:44:05 +09:30