debug: Add debug_syslog_format setting
commit5e1e9d74ab6f59a62ac8dae3239299a0ef334708
authorMartin Schwenke <martin@meltin.net>
Thu, 28 Oct 2021 08:05:19 +0000 (28 19:05 +1100)
committerRalph Boehme <slow@samba.org>
Mon, 1 Nov 2021 06:37:32 +0000 (1 06:37 +0000)
tree8bf35fe8965fc5ca5dd09897e00d8f320f9cc87f
parentbe3a47e22ad6be204f4a7d6070f82f990c17e6fb
debug: Add debug_syslog_format setting

Without debug_hires_timestamp this produces a syslog style header
containing:

  "MON DD HH:MM:SS HOSTNAME PROGNAME[PID] "

With debug_hires_timestamp this produces a syslog style header
containing:

  "RFC5424-TIMESTAMP HOSTNAME PROGNAME[PID] "

All other settings are ignored.

This will be made visible via smb.conf in a subsequent commit.

This commit adds some simple hostname handling.  It avoids using
get_myname() from util.c because using that potentially pulls in all
manner of dependencies.  No real error handling is done.  In the worst
case debug_set_hostname() sets the hostname to a truncated version of
the given string.  Similarly, in an even weirder world,
ensure_hostname() sets the hostname to a truncation of "unknown".
Both of these are unlikely in all reasonable cases.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Ralph Boehme <slow@samba.org>
lib/util/debug.c
lib/util/debug.h