mirror of
https://gitee.com/dgiiot/dgiot.git
synced 2024-11-29 18:57:41 +08:00
add domain
This commit is contained in:
parent
3e6623ec39
commit
e8ce9d0f40
@ -27,7 +27,7 @@
|
||||
begin
|
||||
(logger:log(Level, #{}, #{
|
||||
report_cb => fun(_) -> {'$logger_header'() ++ (Format), (Args)} end,
|
||||
domain => [public_dgiot],
|
||||
domain => [dgiot_public],
|
||||
mfa => {?MODULE, ?FUNCTION_NAME, ?FUNCTION_ARITY},
|
||||
line => ?LINE}))
|
||||
end).
|
||||
@ -45,7 +45,7 @@
|
||||
begin
|
||||
(logger:log(Level, #{}, #{
|
||||
report_cb => fun(_) -> Map end,
|
||||
domain => [public_dgiot],
|
||||
domain => [dgiot_public],
|
||||
mfa => {?MODULE, ?FUNCTION_NAME, ?FUNCTION_ARITY},
|
||||
line => ?LINE}))
|
||||
end).
|
||||
|
@ -200,10 +200,10 @@ send(Meta, Payload) when is_list(Payload) ->
|
||||
|
||||
send(#{error_logger := _Error_logger, mfa := {M, F, A}} = _Meta, Payload) ->
|
||||
Mfa = <<(atom_to_binary(M, utf8))/binary, $/, (atom_to_binary(F, utf8))/binary, $/, (integer_to_binary(A))/binary>>,
|
||||
Topic = <<"logger_trace/", Mfa/binary>>,
|
||||
Topic = <<"logger_trace/error/", Mfa/binary>>,
|
||||
dgiot_mqtt:publish(Mfa, Topic, Payload),
|
||||
Map = jiffy:decode(Payload, [return_maps]),
|
||||
NewMap = maps:with([<<"time">>, <<"pid">>, <<"msg">>, <<"mfa">>, <<"line">>, <<"level">>, <<"clientid">>, <<"topic">>, <<"peername">>],Map),
|
||||
NewMap = maps:with([<<"domain">>,<<"time">>, <<"pid">>, <<"msg">>, <<"mfa">>, <<"line">>, <<"level">>, <<"clientid">>, <<"topic">>, <<"peername">>],Map),
|
||||
dgiot_parse_cache:save_to_cache(#{<<"method">> => <<"POST">>,
|
||||
<<"path">> => <<"/classes/Log">>,
|
||||
<<"body">> => get_body(NewMap)});
|
||||
@ -232,7 +232,7 @@ send(#{mfa := _MFA} = _Meta, Payload) ->
|
||||
<<"logger_trace/log/", Mfa/binary, "/", Line/binary>>
|
||||
end,
|
||||
dgiot_mqtt:publish(Mfa, Topic, Payload),
|
||||
NewMap = maps:with([<<"time">>, <<"pid">>, <<"msg">>, <<"mfa">>, <<"line">>, <<"level">>, <<"clientid">>, <<"topic">>, <<"peername">>],Map),
|
||||
NewMap = maps:with([<<"domain">>,<<"time">>, <<"pid">>, <<"msg">>, <<"mfa">>, <<"line">>, <<"level">>, <<"clientid">>, <<"topic">>, <<"peername">>],Map),
|
||||
dgiot_parse_cache:save_to_cache(#{
|
||||
<<"method">> => <<"POST">>,
|
||||
<<"path">> => <<"/classes/Log">>,
|
||||
|
@ -42,9 +42,10 @@
|
||||
-define(LOG(Level, Format), ?LOG(Level, Format, [])).
|
||||
|
||||
-define(LOG(Level, Format, Args),
|
||||
begin
|
||||
(logger:log(Level,#{},#{report_cb => fun(_) -> {'$logger_header'()++(Format), (Args)} end,
|
||||
mfa => {?MODULE, ?FUNCTION_NAME, ?FUNCTION_ARITY},
|
||||
line => ?LINE}))
|
||||
end).
|
||||
begin
|
||||
(logger:log(Level, #{}, #{report_cb => fun(_) -> {'$logger_header'() ++ (Format), (Args)} end,
|
||||
domain => [emqx_public],
|
||||
mfa => {?MODULE, ?FUNCTION_NAME, ?FUNCTION_ARITY},
|
||||
line => ?LINE}))
|
||||
end).
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user