diff options
author | Alexey Shchepin <alexey@process-one.net> | 2005-12-24 05:40:35 +0300 |
---|---|---|
committer | Alexey Shchepin <alexey@process-one.net> | 2005-12-24 05:40:35 +0300 |
commit | 7ee3e45df17d81f88b454ba9427cfa2621391b01 (patch) | |
tree | 4a352dbc5ed0b5a34a5a606c279d852766db5897 /src | |
parent | 784edef4b6059f9376ab13956af81590f255bc26 (diff) |
* src/ejabberd_logger_h.erl: Speed optimizations
SVN Revision: 481
Diffstat (limited to 'src')
-rw-r--r-- | src/ejabberd_logger_h.erl | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/ejabberd_logger_h.erl b/src/ejabberd_logger_h.erl index dff4553a2..462f408d4 100644 --- a/src/ejabberd_logger_h.erl +++ b/src/ejabberd_logger_h.erl @@ -29,7 +29,7 @@ %% Other %%---------------------------------------------------------------------- init(File) -> - case file:open(File, [append]) of + case file:open(File, [append, raw]) of {ok, Fd} -> {ok, #state{fd = Fd, file = File}}; Error -> @@ -66,7 +66,7 @@ handle_info({'EXIT', _Fd, _Reason}, _State) -> remove_handler; handle_info({emulator, _GL, reopen}, State) -> file:close(State#state.fd), - case file:open(State#state.file, [append]) of + case file:open(State#state.file, [append, raw]) of {ok, Fd} -> {ok, State#state{fd = Fd}}; Error -> @@ -101,38 +101,38 @@ write_event(Fd, {Time, {error, _GL, {Pid, Format, Args}}}) -> T = write_time(Time), case catch io_lib:format(add_node(Format,Pid), Args) of S when list(S) -> - io:format(Fd, T ++ S, []); + file:write(Fd, io_lib:format(T ++ S, [])); _ -> F = add_node("ERROR: ~p - ~p~n", Pid), - io:format(Fd, T ++ F, [Format,Args]) + file:write(Fd, io_lib:format(T ++ F, [Format,Args])) end; write_event(Fd, {Time, {emulator, _GL, Chars}}) -> T = write_time(Time), case catch io_lib:format(Chars, []) of S when list(S) -> - io:format(Fd, T ++ S, []); + file:write(Fd, io_lib:format(T ++ S, [])); _ -> - io:format(Fd, T ++ "ERROR: ~p ~n", [Chars]) + file:write(Fd, io_lib:format(T ++ "ERROR: ~p ~n", [Chars])) end; write_event(Fd, {Time, {info, _GL, {Pid, Info, _}}}) -> T = write_time(Time), - io:format(Fd, T ++ add_node("~p~n",Pid),[Info]); + file:write(Fd, io_lib:format(T ++ add_node("~p~n",Pid), [Info])); write_event(Fd, {Time, {error_report, _GL, {Pid, std_error, Rep}}}) -> T = write_time(Time), S = format_report(Rep), - io:format(Fd, T ++ S ++ add_node("", Pid), []); + file:write(Fd, io_lib:format(T ++ S ++ add_node("", Pid), [])); write_event(Fd, {Time, {info_report, _GL, {Pid, std_info, Rep}}}) -> T = write_time(Time, "INFO REPORT"), S = format_report(Rep), - io:format(Fd, T ++ S ++ add_node("", Pid), []); + file:write(Fd, io_lib:format(T ++ S ++ add_node("", Pid), [])); write_event(Fd, {Time, {info_msg, _GL, {Pid, Format, Args}}}) -> T = write_time(Time, "INFO REPORT"), case catch io_lib:format(add_node(Format,Pid), Args) of S when list(S) -> - io:format(Fd, T ++ S, []); + file:write(Fd, io_lib:format(T ++ S, [])); _ -> F = add_node("ERROR: ~p - ~p~n", Pid), - io:format(Fd, T ++ F, [Format,Args]) + file:write(Fd, io_lib:format(T ++ F, [Format,Args])) end; write_event(_, _) -> ok. |