Addins
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
-export([log/2, log/3]).
|
||||
|
||||
|
||||
-spec log(Level, Format) -> ok
|
||||
when Level :: info
|
||||
| warning
|
||||
| error,
|
||||
Format :: string().
|
||||
%% @private
|
||||
%% @equiv log(Level, Format, [])
|
||||
|
||||
log(Level, Format) ->
|
||||
log(Level, Format, []).
|
||||
|
||||
|
||||
-spec log(Level, Format, Args) -> ok
|
||||
when Level :: info
|
||||
| warning
|
||||
| error,
|
||||
Format :: string(),
|
||||
Args :: [term()].
|
||||
%% @private
|
||||
%% A logging abstraction to hide whatever logging back end is actually in use.
|
||||
%% Format must adhere to Erlang format string rules, and the arity of Args must match
|
||||
%% the provided format.
|
||||
|
||||
log(Level, Format, Args) ->
|
||||
Tag =
|
||||
case Level of
|
||||
info -> "[INFO]";
|
||||
warning -> "[WARNING]";
|
||||
error -> "[ERROR]"
|
||||
end,
|
||||
io:format("~s ~p: " ++ Format ++ "~n", [Tag, self() | Args]).
|
||||
Reference in New Issue
Block a user