remove lager

This commit is contained in:
anlicheng 2026-01-15 15:55:41 +08:00
parent a17453022d
commit c1676115a6
3 changed files with 27 additions and 34 deletions

View File

@ -259,7 +259,7 @@ handle_info({move_network, ReceiverPid, Ref, NetworkPid, HostName},
State = #state{transport = Transport, socket = Sock, client_id = ClientId, mac = Mac, pub_key = PubKey, packet_id = PacketId, inflight = Inflight, is_registered = true}) -> State = #state{transport = Transport, socket = Sock, client_id = ClientId, mac = Mac, pub_key = PubKey, packet_id = PacketId, inflight = Inflight, is_registered = true}) ->
%% network的对应关系 %% network的对应关系
case sdlan_network:assign_ip_addr(NetworkPid, self(), ClientId, Mac, 0, HostName) of case sdlan_network:assign_ip_addr(NetworkPid, self(), ClientId, Mac) of
{ok, Domain, NetAddr, NetBitLen, AesKey} -> {ok, Domain, NetAddr, NetBitLen, AesKey} ->
RsaPubKey = sdlan_cipher:rsa_pem_decode(PubKey), RsaPubKey = sdlan_cipher:rsa_pem_decode(PubKey),
EncodedAesKey = rsa_encode(AesKey, RsaPubKey), EncodedAesKey = rsa_encode(AesKey, RsaPubKey),

View File

@ -62,37 +62,30 @@
]}, ]},
%% 系统日志配置系统日志为lager, 支持日志按日期自动分割 %% 系统日志配置系统日志为lager, 支持日志按日期自动分割
{lager, [ {kernel, [
{colored, true}, %% 设置 Logger 的 primary log level
%% Whether to write a crash log, and where. Undefined means no crash logger. {logger_level, debug},
{crash_log, "trade_hub.crash.log"}, {logger, [
%% Maximum size in bytes of events in the crash log - defaults to 65536 {handler, default, logger_std_h,
{crash_log_msg_size, 65536}, #{
%% Maximum size of the crash log in bytes, before its rotated, set level => debug,
%% to 0 to disable rotation - default is 0 formatter => {logger_formatter, #{template => [time, " [", level, "] ", msg, "\n"]}}
{crash_log_size, 10485760}, }
%% What time to rotate the crash log - default is no time },
%% rotation. See the README for a description of this format.
{crash_log_date, "$D0"},
%% Number of rotated crash logs to keep, 0 means keep only the
%% current one - default is 0
{crash_log_count, 5},
%% Whether to redirect error_logger messages into lager - defaults to true
{error_logger_redirect, true},
%% How big the gen_event mailbox can get before it is switched into sync mode {handler, disk, logger_disk_log_h,
{async_threshold, 20}, #{
%% Switch back to async mode, when gen_event mailbox size decrease from `async_threshold' level => debug,
%% to async_threshold - async_threshold_window config => #{
{async_threshold_window, 5}, file => "log/debug.log",
max_no_files => 10,
max_no_bytes => 524288000
},
formatter => {logger_formatter, #{template => [time, " [", level, "] ", msg, "\n"]}}
}
}
{handlers, [
%% debug | info | warning | error, 日志级别
{lager_console_backend, debug},
{lager_file_backend, [{file, "debug.log"}, {level, debug}, {size, 314572800}]},
{lager_file_backend, [{file, "notice.log"}, {level, notice}, {size, 314572800}]},
{lager_file_backend, [{file, "error.log"}, {level, error}, {size, 314572800}]},
{lager_file_backend, [{file, "info.log"}, {level, info}, {size, 314572800}]}
]} ]}
]} ]}
]. ].

View File

@ -1,4 +1,7 @@
{erl_opts, [debug_info]}. {erl_opts, [
debug_info
]}.
{deps, [ {deps, [
{poolboy, ".*", {git, "https://github.com/devinus/poolboy.git", {tag, "1.5.1"}}}, {poolboy, ".*", {git, "https://github.com/devinus/poolboy.git", {tag, "1.5.1"}}},
{hackney, ".*", {git, "https://github.com/benoitc/hackney.git", {tag, "1.16.0"}}}, {hackney, ".*", {git, "https://github.com/benoitc/hackney.git", {tag, "1.16.0"}}},
@ -43,7 +46,4 @@
%% {mode, minimal} %% {mode, minimal}
] ]
}]}]}. }]}]}.
{erl_opts, [{parse_transform,lager_transform}]}.
{rebar_packages_cdn, "https://hexpm.upyun.com"}. {rebar_packages_cdn, "https://hexpm.upyun.com"}.