]> granicus.if.org Git - ejabberd/commitdiff
* src/ejabberd_logger_h.erl: Speed optimizations
authorAlexey Shchepin <alexey@process-one.net>
Sat, 24 Dec 2005 02:40:35 +0000 (02:40 +0000)
committerAlexey Shchepin <alexey@process-one.net>
Sat, 24 Dec 2005 02:40:35 +0000 (02:40 +0000)
SVN Revision: 481

ChangeLog
src/ejabberd_logger_h.erl

index 283e853cd569387f9693f0ae5a060927a406b3dc..8dba50b626b36cf6c39158d31bc08ce9fcb3594d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * src/Makefile.in: Clean results of ASN.1 compiler (thanks to
index dff4553a23ec17ebfa19ef4111a56a1fe4af4e37..462f408d427684c37ee590b42ef530fc4b443215 100644 (file)
@@ -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.