瀏覽代碼

Pids are sometimes not pids, print them more safely

pull/7/head
Andrew Thompson 14 年之前
父節點
當前提交
5fe8f7c2ad
共有 1 個檔案被更改,包括 2 行新增2 行删除
  1. +2
    -2
      src/lager.erl

+ 2
- 2
src/lager.erl 查看文件

@ -70,14 +70,14 @@ log(Level, Module, Function, Line, Pid, Time, Format, Args) ->
-spec log(log_level(), pid(), list()) -> ok | {error, lager_not_running}.
log(Level, Pid, Message) ->
Timestamp = lager_util:format_time(),
Msg = [["[", atom_to_list(Level), "] "], [pid_to_list(Pid), " "], string:strip(lists:flatten(Message), right, $\n)],
Msg = [["[", atom_to_list(Level), "] "], io_lib:format("~p ", [Pid]), string:strip(lists:flatten(Message), right, $\n)],
safe_notify(lager_util:level_to_num(Level), Timestamp, Msg).
%% @doc Manually log a message into lager without using the parse transform.
-spec log(log_level(), pid(), string(), list()) -> ok | {error, lager_not_running}.
log(Level, Pid, Format, Args) ->
Timestamp = lager_util:format_time(),
Msg = [["[", atom_to_list(Level), "] "], [pid_to_list(Pid), " "], string:strip(lists:flatten(io_lib:format(Format, Args)), right, $\n)],
Msg = [["[", atom_to_list(Level), "] "], io_lib:format("~p ", [Pid]), string:strip(lists:flatten(io_lib:format(Format, Args)), right, $\n)],
safe_notify(lager_util:level_to_num(Level), Timestamp, Msg).
%% @doc Set the loglevel for a particular backend.

Loading…
取消
儲存