fixeria has uploaded this change for review. ( 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(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-s1gw refs/changes/27/37327/1
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"]}}}}]}]}].