[v10,00/10] Logging enhancements.

Message ID 20240321161146.340421-1-stephen@networkplumber.org (mailing list archive)
Headers
Series Logging enhancements. |

Message

Stephen Hemminger March 21, 2024, 4 p.m. UTC
  Improvements and unification of logging library (for 24.07 release).
This is update to earlier patch set. It adds two 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. The message going into
    syslog is already timestamped (by syslog) so no additional
    timestamp is needed.

  * 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.

Note: neither of these are possible on Windows because the
fopencookie() function is a GNU libc and not Posix feature.

Will add a release note in next release (after this is merged).

v10 - put windows getopt patch in series since otherwise windows build fails.
    - support multiple timestamp formats
    - support colorized output
    - fix up rte_init_alert() and rte_exit() to match format
      expected by the timestamp and color modes
    - initialize logging much earlier in startup
    - add documentation about logging options

Stephen Hemminger (10):
  windows: make getopt functions have const properties
  log: unify logging code
  eal: make eal_log_level_parse common
  eal: initialize log earlier in startup
  eal: do not duplicate rte_init_alert() messages
  eal: change rte_exit() output to match rte_log()
  eal: allow user to set default log stream before init
  eal: add option to put timestamp on console output
  log: colorize log output
  doc: add documentation of logging options

 app/dumpcap/main.c                            |   3 +
 app/pdump/main.c                              |   3 +
 app/proc-info/main.c                          |   3 +
 app/test/test_eal_flags.c                     |  17 +
 doc/guides/linux_gsg/eal_args.include.rst     |  54 ++-
 doc/guides/linux_gsg/linux_eal_parameters.rst |  27 --
 doc/guides/prog_guide/log_lib.rst             |  28 +-
 lib/eal/common/eal_common_debug.c             |  11 +-
 lib/eal/common/eal_common_options.c           |  70 +++-
 lib/eal/common/eal_options.h                  |   5 +
 lib/eal/freebsd/eal.c                         |  53 +--
 lib/eal/linux/eal.c                           |  58 +---
 lib/eal/unix/eal_unix_log.c                   |   0
 lib/eal/windows/eal.c                         |  35 --
 lib/eal/windows/getopt.c                      |  23 +-
 lib/eal/windows/include/getopt.h              |   8 +-
 lib/log/log.c                                 |   6 +
 lib/log/log_freebsd.c                         |  12 -
 lib/log/log_internal.h                        |  16 +
 lib/log/log_linux.c                           |  61 ----
 lib/log/log_unix.c                            | 321 ++++++++++++++++++
 lib/log/log_windows.c                         |  12 +
 lib/log/meson.build                           |  12 +-
 lib/log/version.map                           |   3 +
 24 files changed, 577 insertions(+), 264 deletions(-)
 create mode 100644 lib/eal/unix/eal_unix_log.c
 delete mode 100644 lib/log/log_freebsd.c
 delete mode 100644 lib/log/log_linux.c
 create mode 100644 lib/log/log_unix.c