Skip to content

Commit

Permalink
Logging improvements master (2600hz#4401)
Browse files Browse the repository at this point in the history
* don't clobber the metadata

Conflicts:
	core/kazoo/src/kz_util.erl

* only output things we have a value for, output msg_id and callid potentially

Conflicts:
	rel/sys.config
  • Loading branch information
mark2600 authored and lazedo committed Dec 18, 2017
1 parent 947ffd6 commit 64e0e0b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions core/kazoo/src/kz_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -623,11 +623,11 @@ try_load_module(Name) ->
%%--------------------------------------------------------------------
-spec put_callid(kz_json:object() | kz_proplist() | ne_binary() | atom()) -> 'ok'.
put_callid(?NE_BINARY = CallId) ->
_ = lager:md([{'callid', CallId}]),
_ = lager:md([{'callid', CallId}]++lager:md()),
_ = erlang:put('callid', CallId),
'ok';
put_callid(Atom) when is_atom(Atom) ->
_ = lager:md([{'callid', Atom}]),
_ = lager:md([{'callid', Atom}]++lager:md()),
_ = erlang:put('callid', Atom),
'ok';
put_callid(APITerm) ->
Expand Down
2 changes: 1 addition & 1 deletion core/kazoo_amqp/src/api/kz_api.erl
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ build_message_specific(Prop, ReqH, OptH) ->

-spec headers_to_json(kz_proplist()) -> api_formatter_return().
headers_to_json([_|_]=HeadersProp) ->
lager:md([{'msg_id', msg_id(HeadersProp)}]),
lager:md([{'msg_id', msg_id(HeadersProp)}]++lager:md()),
try kz_json:encode(kz_json:from_list(HeadersProp)) of
JSON -> {'ok', JSON}
catch
Expand Down
6 changes: 3 additions & 3 deletions rel/sys.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
,{formatter_config, [time, " ", color, severity, " ", {module,[module],""}, {line,[".",line," "],""}, "\e[0m", message, "\n"]}]}
,{lager_file_backend, [{file, "log/error.log"}, {level, error}, {size, 10485760}, {date, "$D0"}, {count, 5}
,{formatter, lager_default_formatter}
,{formatter_config, [time," [",severity,"] ", "|", {callid, <<"0000000000">>}, "|", module, ":", line, " (",pid, ") ", message, "\n"]}
,{formatter_config, [time," [",severity,"] ", {log_id, ["|", log_id, "|"], [{msg_id, ["|", msg_id, "-", callid, "|"], [{callid, ["|", callid, "|"], ""}]}]}, {module, ""}, {line, [":", line, " "], ""}, "(",pid, ") ", message, "\n"]}
]}
,{lager_file_backend, [{file, "log/console.log"}, {level, info}, {size, 10485760}, {date, "$D0"}, {count, 5}
,{formatter, lager_default_formatter}
,{formatter_config, [time," [",severity,"] ", "|", {callid, <<"0000000000">>}, "|", module, ":", line, " (",pid, ") ", message, "\n"]}
,{formatter_config, [time," [",severity,"] ", {log_id, ["|", log_id, "|"], [{msg_id, ["|", msg_id, "-", callid, "|"], [{callid, ["|", callid, "|"], ""}]}]}, {module, ""}, {line, [":", line, " "], ""}, "(",pid, ") ", message, "\n"]}
]}
,{lager_syslog_backend, ["2600hz", local0, debug
,{lager_default_formatter, ["|", {callid, <<"0000000000">>}, "|", module, ":", line, " (",pid, ") ", message, "\n"]}
,{lager_default_formatter, [{log_id, ["|", log_id, "|"], [{msg_id, ["|", msg_id, "-", callid, "|"], [{callid, ["|", callid, "|"], ""}]}]}, {module, ""}, {line, [":", line, " "], ""}, "(",pid, ") ", message, "\n"]}
]}
]}
,{extra_sinks, [{data_lager_event,[{handlers, [{lager_file_backend,[{file, "/dev/null"} ,{level, debug}]}]}]}]}
Expand Down

0 comments on commit 64e0e0b

Please sign in to comment.