change to json log

This commit is contained in:
lsxredrain 2021-08-22 01:44:54 +08:00
parent ac004c395a
commit 367c081eaf
5 changed files with 5 additions and 3 deletions

View File

@ -44,7 +44,7 @@
-define(LOG(Level, Format, Args),
begin
(logger:log(Level,#{},#{report_cb => fun(_) ->
{'$logger_header'() ++ "[~p:~p ~p] [~s:~p] " ++ (Format), ([?MODULE, ?FUNCTION_NAME, ?LINE, node(),self()] ++ Args)} end,
{'$logger_header'() ++ (Format), ( Args)} end,
mfa => {?MODULE, ?FUNCTION_NAME, ?FUNCTION_ARITY},
line => ?LINE}))
end).

View File

@ -18,6 +18,7 @@
-module(dgiot_datetime).
-author("johnliu").
-include_lib("dgiot/include/logger.hrl").
-logger_header("[dgiot]").
-export([
start_time/0,

View File

@ -17,6 +17,7 @@
-module(dgiot_license).
-author("johnliu").
-include_lib("dgiot/include/logger.hrl").
-logger_header("[dgiot]").
-export([init/1
, description/0

View File

@ -448,7 +448,7 @@ log.file = emqx.log
## Log formatter
## Value: text | json
#log.formatter = text
log.formatter = json
## Log to single line
## Value: Boolean

View File

@ -502,7 +502,7 @@ end}.
%% @doc format logs as JSON objects
{mapping, "log.formatter", "kernel.logger", [
{default, text},
{default, json},
{datatype, {enum, [text, json]}}
]}.