On 2024-03-24 03:33, Stephen Hemminger wrote:
Improvements and unification of logging library (for 24.07 release).
This version works on all platforms: Linux, Windows and FreeBSD.
This is update to rework patch set. It adds several new features
to the console log output.
* Putting a timestamp on console output which is useful for
analyzing performance of startup codes. Timestamp is optional
and must be enabled on command line.
* Displaying console output with colors.
It uses the standard conventions used by many other Linux commands
for colorized display. The default is to enable color if the
console output is going to a terminal. But it can be always
on or disabled by command line flag. This default was chosen
based on what dmesg(1) command does.
I find color helpful because DPDK drivers and libraries print
lots of not very useful messages. And having error messages
highlighted in bold face helps. This might also get users to
pay more attention to error messages. Many bug reports have
earlier messages that are lost because there are so many
info messages.
* Use of syslog on Linux is replaced by using journal
API (over unix domain socket). This replaces legacy syslog;
(almost) all Linux distros have switched to journal.
Is "switched to journal" the same as "switched to systemd", or are there
non-systemd journal API implementations?
I'm guessing there are quite a few Linux-based embedded systems that
doesn't use systemd.
Ideally, you would like to have journal as the Linux default, and then
syslog as a build-time option.
Will add a release note in next release (after this is merged)
v11 - rework to be portable to Windows
drop syslog support and support journal instead
Stephen Hemminger (9):
windows: make getopt functions have const properties
eal: make eal_log_level_parse common
eal: do not duplicate rte_init_alert() messages
eal: change rte_exit() output to match rte_log()
log: drop syslog support, and make code common
log: add hook for printing log messages
log: add timestamp option
log: add support for systemd journal
log: colorize log output
app/test/test_eal_flags.c | 38 +-
doc/guides/linux_gsg/linux_eal_parameters.rst | 27 -
.../prog_guide/env_abstraction_layer.rst | 5 +-
doc/guides/prog_guide/log_lib.rst | 41 +-
lib/eal/common/eal_common_debug.c | 11 +-
lib/eal/common/eal_common_options.c | 123 ++---
lib/eal/common/eal_internal_cfg.h | 2 +-
lib/eal/common/eal_options.h | 7 +-
lib/eal/freebsd/eal.c | 54 +-
lib/eal/linux/eal.c | 52 +-
lib/eal/unix/eal_debug.c | 3 +-
lib/eal/windows/eal.c | 39 +-
lib/eal/windows/getopt.c | 23 +-
lib/eal/windows/include/getopt.h | 8 +-
lib/log/log.c | 513 ++++++++++++++++--
lib/log/log_freebsd.c | 12 -
lib/log/log_internal.h | 16 +-
lib/log/log_linux.c | 61 ---
lib/log/log_windows.c | 18 -
lib/log/meson.build | 5 +-
lib/log/version.map | 2 +
21 files changed, 656 insertions(+), 404 deletions(-)
delete mode 100644 lib/log/log_freebsd.c
delete mode 100644 lib/log/log_linux.c
delete mode 100644 lib/log/log_windows.c