From f6587468898ef63e49fe83cc56f97b5b3d3a3d1d Mon Sep 17 00:00:00 2001 From: Matthew Pope Date: Sat, 31 Aug 2024 11:48:20 -0700 Subject: [PATCH] feature: io:format -> logger --- src/luerl_comp.erl | 8 ++++---- src/luerl_lib_basic.erl | 6 +++--- src/luerl_lib_io.erl | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/luerl_comp.erl b/src/luerl_comp.erl index 887ee09..fd35fa3 100644 --- a/src/luerl_comp.erl +++ b/src/luerl_comp.erl @@ -313,17 +313,17 @@ debug_print(Opts, Format, Args) -> list_warnings(F, Ws) -> foreach(fun ({Line,Mod,Warn}) -> Cs = Mod:format_error(Warn), - io:format("~s:~w: Warning: ~s\n", [F,Line,Cs]); + logger:warning("~s:~w: Warning: ~s\n", [F,Line,Cs]); ({Mod,Warn}) -> Cs = Mod:format_error(Warn), - io:format("~s: Warning: ~s\n", [F,Cs]) + logger:warning("~s: Warning: ~s\n", [F,Cs]) end, Ws). list_errors(F, Es) -> foreach(fun ({Line,Mod,Error}) -> Cs = Mod:format_error(Error), - io:format("~s:~w: ~s\n", [F,Line,Cs]); + logger:error("~s:~w: ~s\n", [F,Line,Cs]); ({Mod,Error}) -> Cs = Mod:format_error(Error), - io:format("~s: ~s\n", [F,Cs]) + logger:error("~s: ~s\n", [F,Cs]) end, Es). diff --git a/src/luerl_lib_basic.erl b/src/luerl_lib_basic.erl index 6b52b62..8ca0d03 100644 --- a/src/luerl_lib_basic.erl +++ b/src/luerl_lib_basic.erl @@ -88,8 +88,8 @@ collectgarbage(_, _, St) -> %Ignore everything else eprint(_, Args, St) -> lists:foreach(fun (#tref{}=Tref) -> Tab = luerl_heap:get_table(Tref, St), - io:format("~w ", [Tab]); - (A) -> io:format("~w ", [A]) + logger:error("~w ", [Tab]); + (A) -> logger:error("~w ", [A]) end, Args), io:nl(), {[],St}. @@ -204,7 +204,7 @@ next_key(K, Dict, St) -> print(_, Args, St0) -> St1 = lists:foldl(fun (A, S0) -> {[Str],S1} = tostring([A], S0), - io:format("~ts ", [Str]), + logger:info("~ts ", [Str]), S1 end, St0, Args), io:nl(), diff --git a/src/luerl_lib_io.erl b/src/luerl_lib_io.erl index 67377b4..d63eae6 100644 --- a/src/luerl_lib_io.erl +++ b/src/luerl_lib_io.erl @@ -42,6 +42,6 @@ write(_, As, St) -> case luerl_lib:args_to_strings(As) of error -> badarg_error(write, As, St); Ss -> - lists:foreach(fun (S) -> io:format("~s", [S]) end, Ss), + lists:foreach(fun (S) -> logger:info("~s", [S]) end, Ss), {[#userdata{d=standard_io}],St} end.