The log module buffers outgoing messages by default; add an
api to turn that off, and emit messages immediately.
Signed-off-by: Mark Stapp <mjs@voltanet.io>
This logs the unique ID prefix from the xref that each log message call
has, and adds on/off knobs for both EC and unique ID printing.
Signed-off-by: David Lamparter <equinox@diac24.net>
Apparently you can do `#__VA_ARGS__` and it actually does something
sensible, so here we go recording the format parameters for log messages
into the xref.
This allows some more checking in xrelfo.py, e.g. hints to use `%pFX`
and co.
Signed-off-by: David Lamparter <equinox@diac24.net>
Since some recent commit, building c++ code attempting to use zlog_debug
(or any other level) would fail with the following complaint:
lib/zlog.h:91:3: sorry, unimplemented: non-trivial designated
initializers not supported
};
^
lib/zlog.h:105:26: note: in expansion of macro ‘_zlog_ref’
#define zlog_debug(...) _zlog_ref(LOG_DEBUG, __VA_ARGS__)
This is due to out-of-order initialization of the xrefdata struct
fields. Setting them all in the order in which they are defined
fixes the issue.
Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
This allows extracting a list of all log messages including their ECs
and autogenerated unique IDs for them.
Signed-off-by: David Lamparter <equinox@diac24.net>
This is a full rewrite of the "back end" logging code. It now uses a
lock-free list to iterate over logging targets, and the targets
themselves are as lock-free as possible. (syslog() may have a hidden
internal mutex in the C library; the file/fd targets use a single
write() call which should ensure atomicity kernel-side.)
Note that some functionality is lost in this patch:
- Solaris printstack() backtraces are ditched (unlikely to come back)
- the `log-filter` machinery is gone (re-added in followup commit)
- `terminal monitor` is temporarily stubbed out. The old code had a
race condition with VTYs going away. It'll likely come back rewritten
and with vtysh support.
- The `zebra_ext_log` hook is gone. Instead, it's now much easier to
add a "proper" logging target.
v2: TLS buffer to get some actual performance
Signed-off-by: David Lamparter <equinox@diac24.net>