Browse Source

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 years ago
parent
commit
730ab66717
3 changed files with 6 additions and 6 deletions
  1. +1
    -0
      include/lager.hrl
  2. +2
    -2
      src/lager.erl
  3. +3
    -4
      src/lager_config.erl

+ 1
- 0
include/lager.hrl View File

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

+ 2
- 2
src/lager.erl View File

@ -83,7 +83,7 @@ md(_) ->
dispatch_log(Severity, Metadata, Format, Args, Size) when is_atom(Severity)-> 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}. -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 %% 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 %% @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. %% has multiple identifiers, the lowest is returned.
get_loglevel(Handler) -> 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 %% @doc Get the loglevel for a particular sink's backend. In the case that the backend
%% has multiple identifiers, the lowest is returned. %% has multiple identifiers, the lowest is returned.

+ 3
- 4
src/lager_config.erl View File

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

Loading…
Cancel
Save