mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
* src/ejabberd_logger_h.erl: Speed optimizations
SVN Revision: 481
This commit is contained in:
parent
784edef4b6
commit
7ee3e45df1
@ -1,3 +1,7 @@
|
|||||||
|
2005-12-24 Alexey Shchepin <alexey@sevcom.net>
|
||||||
|
|
||||||
|
* src/ejabberd_logger_h.erl: Speed optimizations
|
||||||
|
|
||||||
2005-12-22 Alexey Shchepin <alexey@sevcom.net>
|
2005-12-22 Alexey Shchepin <alexey@sevcom.net>
|
||||||
|
|
||||||
* src/Makefile.in: Clean results of ASN.1 compiler (thanks to
|
* src/Makefile.in: Clean results of ASN.1 compiler (thanks to
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
%% Other
|
%% Other
|
||||||
%%----------------------------------------------------------------------
|
%%----------------------------------------------------------------------
|
||||||
init(File) ->
|
init(File) ->
|
||||||
case file:open(File, [append]) of
|
case file:open(File, [append, raw]) of
|
||||||
{ok, Fd} ->
|
{ok, Fd} ->
|
||||||
{ok, #state{fd = Fd, file = File}};
|
{ok, #state{fd = Fd, file = File}};
|
||||||
Error ->
|
Error ->
|
||||||
@ -66,7 +66,7 @@ handle_info({'EXIT', _Fd, _Reason}, _State) ->
|
|||||||
remove_handler;
|
remove_handler;
|
||||||
handle_info({emulator, _GL, reopen}, State) ->
|
handle_info({emulator, _GL, reopen}, State) ->
|
||||||
file:close(State#state.fd),
|
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, Fd} ->
|
||||||
{ok, State#state{fd = Fd}};
|
{ok, State#state{fd = Fd}};
|
||||||
Error ->
|
Error ->
|
||||||
@ -101,38 +101,38 @@ write_event(Fd, {Time, {error, _GL, {Pid, Format, Args}}}) ->
|
|||||||
T = write_time(Time),
|
T = write_time(Time),
|
||||||
case catch io_lib:format(add_node(Format,Pid), Args) of
|
case catch io_lib:format(add_node(Format,Pid), Args) of
|
||||||
S when list(S) ->
|
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),
|
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;
|
end;
|
||||||
write_event(Fd, {Time, {emulator, _GL, Chars}}) ->
|
write_event(Fd, {Time, {emulator, _GL, Chars}}) ->
|
||||||
T = write_time(Time),
|
T = write_time(Time),
|
||||||
case catch io_lib:format(Chars, []) of
|
case catch io_lib:format(Chars, []) of
|
||||||
S when list(S) ->
|
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;
|
end;
|
||||||
write_event(Fd, {Time, {info, _GL, {Pid, Info, _}}}) ->
|
write_event(Fd, {Time, {info, _GL, {Pid, Info, _}}}) ->
|
||||||
T = write_time(Time),
|
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}}}) ->
|
write_event(Fd, {Time, {error_report, _GL, {Pid, std_error, Rep}}}) ->
|
||||||
T = write_time(Time),
|
T = write_time(Time),
|
||||||
S = format_report(Rep),
|
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}}}) ->
|
write_event(Fd, {Time, {info_report, _GL, {Pid, std_info, Rep}}}) ->
|
||||||
T = write_time(Time, "INFO REPORT"),
|
T = write_time(Time, "INFO REPORT"),
|
||||||
S = format_report(Rep),
|
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}}}) ->
|
write_event(Fd, {Time, {info_msg, _GL, {Pid, Format, Args}}}) ->
|
||||||
T = write_time(Time, "INFO REPORT"),
|
T = write_time(Time, "INFO REPORT"),
|
||||||
case catch io_lib:format(add_node(Format,Pid), Args) of
|
case catch io_lib:format(add_node(Format,Pid), Args) of
|
||||||
S when list(S) ->
|
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),
|
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;
|
end;
|
||||||
write_event(_, _) ->
|
write_event(_, _) ->
|
||||||
ok.
|
ok.
|
||||||
|
Loading…
Reference in New Issue
Block a user