diff --git a/apps/sdlan/src/sdlan_channel.erl b/apps/sdlan/src/sdlan_channel.erl index 07b864e..867bd19 100644 --- a/apps/sdlan/src/sdlan_channel.erl +++ b/apps/sdlan/src/sdlan_channel.erl @@ -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}) -> %% 建立到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} -> RsaPubKey = sdlan_cipher:rsa_pem_decode(PubKey), EncodedAesKey = rsa_encode(AesKey, RsaPubKey), diff --git a/config/sys-prod.config b/config/sys-prod.config index c798636..fedf80e 100644 --- a/config/sys-prod.config +++ b/config/sys-prod.config @@ -62,37 +62,30 @@ ]}, %% 系统日志配置,系统日志为lager, 支持日志按日期自动分割 - {lager, [ - {colored, true}, - %% Whether to write a crash log, and where. Undefined means no crash logger. - {crash_log, "trade_hub.crash.log"}, - %% Maximum size in bytes of events in the crash log - defaults to 65536 - {crash_log_msg_size, 65536}, - %% Maximum size of the crash log in bytes, before its rotated, set - %% to 0 to disable rotation - default is 0 - {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}, + {kernel, [ + %% 设置 Logger 的 primary log level + {logger_level, debug}, + {logger, [ + {handler, default, logger_std_h, + #{ + level => debug, + formatter => {logger_formatter, #{template => [time, " [", level, "] ", msg, "\n"]}} + } + }, - %% How big the gen_event mailbox can get before it is switched into sync mode - {async_threshold, 20}, - %% Switch back to async mode, when gen_event mailbox size decrease from `async_threshold' - %% to async_threshold - async_threshold_window - {async_threshold_window, 5}, + {handler, disk, logger_disk_log_h, + #{ + level => debug, + config => #{ + 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}]} ]} ]} + ]. diff --git a/rebar.config b/rebar.config index 19b784d..f9465fd 100644 --- a/rebar.config +++ b/rebar.config @@ -1,4 +1,7 @@ -{erl_opts, [debug_info]}. +{erl_opts, [ + debug_info +]}. + {deps, [ {poolboy, ".*", {git, "https://github.com/devinus/poolboy.git", {tag, "1.5.1"}}}, {hackney, ".*", {git, "https://github.com/benoitc/hackney.git", {tag, "1.16.0"}}}, @@ -43,7 +46,4 @@ %% {mode, minimal} ] }]}]}. - -{erl_opts, [{parse_transform,lager_transform}]}. - {rebar_packages_cdn, "https://hexpm.upyun.com"}. \ No newline at end of file