laforge has submitted this change. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/37327?usp=email )
Change subject: config/sys.config: print prefix before msg, if present ......................................................................
config/sys.config: print prefix before msg, if present
It's sometimes desirable to add some context to logging messages, like the FSM name and identifier, for instance. With this patch, this can be easily achieved by passing an arbitrary prefix string to a logging function/macro:
%% EXAMPLE: adding metadata to a specific log macro ?LOG_INFO("The planet is fine...", #{prefix = "EARTH"}).
or by setting it for all logging of a process:
%% EXAMPLE: adding context for the whole process logger:set_process_metadata(#{prefix => "E-RAB FSM"}).
Change-Id: Ib88801b8d38976b98a02ed06e1638e0e9056bafb --- M config/sys.config 1 file changed, 23 insertions(+), 0 deletions(-)
Approvals: laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/config/sys.config b/config/sys.config index 5ccd43d..cf8ff34 100644 --- a/config/sys.config +++ b/config/sys.config @@ -27,6 +27,7 @@ single_line => false, template => [time, " ", color, "[", level, "]", {pid, [" ", pid, ""], ""}, + {prefix, [" ", prefix, " ::"], ""}, " ", msg, {mfa, [" (", mfa, ":", line, ")"], ""}, reset, "\n"]}}}}]}]}].