瀏覽代碼

For places in the revised API where we use lager_event as a default value, use a macro instead

pull/264/head
John R. Daily 10 年之前
父節點
當前提交
730ab66717
共有 3 個文件被更改,包括 6 次插入6 次删除
  1. +1
    -0
      include/lager.hrl
  2. +2
    -2
      src/lager.erl
  3. +3
    -4
      src/lager_config.erl

+ 1
- 0
include/lager.hrl 查看文件

@ -17,6 +17,7 @@
-define(DEFAULT_TRUNCATION, 4096).
-define(DEFAULT_TRACER, lager_default_tracer).
-define(DEFAULT_SINK, lager_event).
-define(LEVELS,
[debug, info, notice, warning, error, critical, alert, emergency, none]).

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

@ -83,7 +83,7 @@ md(_) ->
dispatch_log(Severity, Metadata, Format, Args, Size) when is_atom(Severity)->
dispatch_log(lager_event, Severity, Metadata, Format, Args, Size).
dispatch_log(?DEFAULT_SINK, Severity, Metadata, Format, Args, Size).
-spec dispatch_log(atom(), log_level(), list(), string(), list() | none, pos_integer()) -> ok | {error, lager_not_running}.
%% this is the same check that the parse transform bakes into the module at compile time
@ -336,7 +336,7 @@ set_loglevel(Sink, Handler, Ident, Level) when is_atom(Level) ->
%% @doc Get the loglevel for a particular backend on the default sink. In the case that the backend
%% has multiple identifiers, the lowest is returned.
get_loglevel(Handler) ->
get_loglevel(lager_event, Handler).
get_loglevel(?DEFAULT_SINK, Handler).
%% @doc Get the loglevel for a particular sink's backend. In the case that the backend
%% has multiple identifiers, the lowest is returned.

+ 3
- 4
src/lager_config.erl 查看文件

@ -45,10 +45,10 @@ new() ->
ok.
get(Key) ->
get(lager_event, Key, undefined).
get(?DEFAULT_SINK, Key, undefined).
get(Key, Default) ->
get(lager_event, Key, Default).
get(?DEFAULT_SINK, Key, Default).
get(Sink, Key, Default) ->
try
@ -64,8 +64,7 @@ get(Sink, Key, Default) ->
end.
set(Key, Value) ->
set(lager_event, Key, Value).
set(?DEFAULT_SINK, Key, Value).
set(Sink, Key, Value) ->
ets:insert(?TBL, {{Sink, Key}, Value}).

Loading…
取消
儲存