diff --git a/apps/efka/src/efka_app.erl b/apps/efka/src/efka_app.erl index 97da891..528e846 100644 --- a/apps/efka/src/efka_app.erl +++ b/apps/efka/src/efka_app.erl @@ -17,7 +17,7 @@ start(_StartType, _StartArgs) -> erlang:system_flag(fullsweep_after, 16), %% 启动tcp的服务 - start_tcp_server(), + % start_tcp_server(), %% 仓库的基础url application:set_env(efka, repository_url, "http://118.178.229.213:3000/anlicheng/ekfa/"), @@ -46,4 +46,4 @@ start_tcp_server() -> ], {ok, _} = esockd:open('efka/tcp_server', Port, TransOpts, {tcp_channel, start_link, []}), - lager:debug("[efka_app] the tcp server start at: ~p", [Port]). \ No newline at end of file + efka_loggeefka_logger:debug("[efka_app] the tcp server start at: ~p", [Port]). \ No newline at end of file diff --git a/apps/efka/src/efka_downloader.erl b/apps/efka/src/efka_downloader.erl index 7789089..513ebce 100644 --- a/apps/efka/src/efka_downloader.erl +++ b/apps/efka/src/efka_downloader.erl @@ -33,7 +33,7 @@ test() -> Ref = download(Pid, Url, TargetDir), receive {download_response, Ref, Info} -> - lager:debug("info is: ~p", [Info]) + efka_logger:debug("info is: ~p", [Info]) end, ok. @@ -96,7 +96,7 @@ handle_cast({download, ReceiverPid, Ref, Url, TargetDir}, State = #state{}) -> EndTs = os:timestamp(), %% 计算操作的时间,单位为毫秒 CostMs = timer:now_diff(EndTs, StartTs) div 1000, - lager:debug("download cost: ~p", [CostMs]), + efka_logger:debug("download cost: ~p", [CostMs]), ReceiverPid ! {download_response, Ref, {ok, CostMs}}; {error, Reason} -> ReceiverPid ! {download_response, Ref, {error, Reason}} @@ -151,7 +151,7 @@ receive_data0(ClientRef, TargetDir, DefaultFile) -> {hackney_response, ClientRef, {headers, Headers}} -> TargetFilename = extra_filename(Headers, DefaultFile), FullFilename = TargetDir ++ TargetFilename, - lager:debug("full name: ~p", [FullFilename]), + efka_logger:debug("full name: ~p", [FullFilename]), {ok, File} = file:open(FullFilename, [write, binary]), receive_data1(ClientRef, File) end. diff --git a/apps/efka/src/efka_logger.erl b/apps/efka/src/efka_logger.erl new file mode 100644 index 0000000..5276dc1 --- /dev/null +++ b/apps/efka/src/efka_logger.erl @@ -0,0 +1,19 @@ +%%%------------------------------------------------------------------- +%%% @author anlicheng +%%% @copyright (C) 2025, +%%% @doc +%%% +%%% @end +%%% Created : 29. 4月 2025 22:39 +%%%------------------------------------------------------------------- +-module(efka_logger). +-author("anlicheng"). + +%% API +-export([debug/2, notice/2]). + +debug(Format, Args) -> + io:format(Format, Args). + +notice(Format, Args) -> + io:format(Format, Args). diff --git a/rebar.lock b/rebar.lock deleted file mode 100644 index 8ccf52f..0000000 --- a/rebar.lock +++ /dev/null @@ -1,57 +0,0 @@ -{"1.2.0", -[{<<"certifi">>,{pkg,<<"certifi">>,<<"2.5.3">>},1}, - {<<"esockd">>, - {git,"https://github.com/emqx/esockd.git", - {ref,"9b959fc11a1c398a589892f335235be6c5b4a454"}}, - 0}, - {<<"fs">>,{pkg,<<"fs">>,<<"6.1.1">>},1}, - {<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.9">>},1}, - {<<"gpb">>, - {git,"https://github.com/tomas-abrahamsson/gpb.git", - {ref,"edda1006d863a09509673778c455d33d88e6edbc"}}, - 0}, - {<<"hackney">>, - {git,"https://github.com/benoitc/hackney.git", - {ref,"f642ee0eccaff9aa15707ae3a3effa29f2920e41"}}, - 0}, - {<<"idna">>,{pkg,<<"idna">>,<<"6.1.1">>},1}, - {<<"jiffy">>, - {git,"https://github.com/davisp/jiffy.git", - {ref,"50daa80a62a97ffb6dd46ea9cb8ccb4930cbf1ae"}}, - 0}, - {<<"lager">>, - {git,"https://github.com/erlang-lager/lager.git", - {ref,"459a3b2cdd9eadd29e5a7ce5c43932f5ccd6eb88"}}, - 0}, - {<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},1}, - {<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.2.0">>},1}, - {<<"parse_trans">>, - {git,"https://github.com/uwiger/parse_trans", - {ref,"6f3645afb43c7c57d61b54ef59aecab288ce1013"}}, - 0}, - {<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.6">>},1}, - {<<"sync">>, - {git,"https://github.com/rustyio/sync.git", - {ref,"7dc303ed4ce8d26db82e171dbbd7c41067852c65"}}, - 0}, - {<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.7.0">>},1}]}. -[ -{pkg_hash,[ - {<<"certifi">>, <<"70BDD7E7188C804F3A30EE0E7C99655BC35D8AC41C23E12325F36AB449B70651">>}, - {<<"fs">>, <<"9D147B944D60CFA48A349F12D06C8EE71128F610C90870BDF9A6773206452ED0">>}, - {<<"goldrush">>, <<"F06E5D5F1277DA5C413E84D5A2924174182FB108DABB39D5EC548B27424CD106">>}, - {<<"idna">>, <<"8A63070E9F7D0C62EB9D9FCB360A7DE382448200FBBD1B106CC96D3D8099DF8D">>}, - {<<"metrics">>, <<"25F094DEA2CDA98213CECC3AEFF09E940299D950904393B2A29D191C346A8486">>}, - {<<"mimerl">>, <<"67E2D3F571088D5CFD3E550C383094B47159F3EEE8FFA08E64106CDF5E981BE3">>}, - {<<"ssl_verify_fun">>, <<"CF344F5692C82D2CD7554F5EC8FD961548D4FD09E7D22F5B62482E5AEAEBD4B0">>}, - {<<"unicode_util_compat">>, <<"BC84380C9AB48177092F43AC89E4DFA2C6D62B40B8BD132B1059ECC7232F9A78">>}]}, -{pkg_hash_ext,[ - {<<"certifi">>, <<"ED516ACB3929B101208A9D700062D520F3953DA3B6B918D866106FFA980E1C10">>}, - {<<"fs">>, <<"EF94E95FFE79916860649FED80AC62B04C322B0BB70F5128144C026B4D171F8B">>}, - {<<"goldrush">>, <<"99CB4128CFFCB3227581E5D4D803D5413FA643F4EB96523F77D9E6937D994CEB">>}, - {<<"idna">>, <<"92376EB7894412ED19AC475E4A86F7B413C1B9FBB5BD16DCCD57934157944CEA">>}, - {<<"metrics">>, <<"69B09ADDDC4F74A40716AE54D140F93BEB0FB8978D8636EADED0C31B6F099F16">>}, - {<<"mimerl">>, <<"F278585650AA581986264638EBF698F8BB19DF297F66AD91B18910DFC6E19323">>}, - {<<"ssl_verify_fun">>, <<"BDB0D2471F453C88FF3908E7686F86F9BE327D065CC1EC16FA4540197EA04680">>}, - {<<"unicode_util_compat">>, <<"25EEE6D67DF61960CF6A794239566599B09E17E668D3700247BC498638152521">>}]} -].