From 72f1ce276401e0b8de9c0c527cbc324da0186939 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Wed, 23 May 2018 12:34:30 +0200 Subject: Change type name logger:log() to logger:log_event() --- lib/kernel/doc/src/logger_chapter.xml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'lib/kernel/doc/src/logger_chapter.xml') diff --git a/lib/kernel/doc/src/logger_chapter.xml b/lib/kernel/doc/src/logger_chapter.xml index dff9ee2892..3b4cafb010 100644 --- a/lib/kernel/doc/src/logger_chapter.xml +++ b/lib/kernel/doc/src/logger_chapter.xml @@ -252,7 +252,7 @@

A handler is defined as a module exporting at least the following function:

-
log(Log, Config)
+
log(LogEvent, Config)

This function is called when a log event has passed through all global filters, and all handler filters attached to the handler @@ -320,7 +320,7 @@ module, FModule and its configuration, FConfig. FModule must export the following function, which can be called by the handler:

-
format(Log,FConfig)
+    
format(LogEvent,FConfig)
 	-> FormattedLogEntry

See the logger_formatter(3) manual for the full @@ -735,7 +735,7 @@ ok

Example: implement a handler

The only requirement that a handler MUST fulfill is to export the following function:

- log(logger:log(),logger:config()) ->ok + log(logger:log_event(),logger:config()) -> ok

It may also implement the following callbacks:

adding_handler(logger:config()) -> {ok,logger:config()} | {error,term()} @@ -763,8 +763,8 @@ changing_config(logger:config(),logger:config()) -> {ok,logger:config()} | {erro -module(myhandler). -export([log/2]). -log(Log,#{formatter:={FModule,FConfig}) -> - io:put_chars(FModule:format(Log,FConfig)). +log(LogEvent,#{formatter:={FModule,FConfig}) -> + io:put_chars(FModule:format(LogEvent,FConfig)).

A simple handler which prints to file could be implemented like @@ -782,8 +782,8 @@ removing_handler(#{myhandler_fd:=Fd}) -> _ = file:close(Fd), ok. -log(Log,#{myhandler_fd:=Fd,formatter:={FModule,FConfig}}) -> - io:put_chars(Fd,FModule:format(Log,FConfig)). +log(LogEvent,#{myhandler_fd:=Fd,formatter:={FModule,FConfig}}) -> + io:put_chars(Fd,FModule:format(LogEvent,FConfig)).

The above handlers do not have any overload @@ -810,8 +810,8 @@ adding_handler(Config) -> removing_handler(#{myhandler_pid:=Pid}) -> gen_server:stop(Pid). -log(Log,#{myhandler_pid:=Pid} = Config) -> - gen_server:cast(Pid,{log,Log,Config}). +log(LogEvent,#{myhandler_pid:=Pid} = Config) -> + gen_server:cast(Pid,{log,LogEvent,Config}). init(#{myhandler_file:=File}) -> {ok,Fd} = file:open(File,[append,{encoding,utf8}]), @@ -820,16 +820,16 @@ init(#{myhandler_file:=File}) -> handle_call(_,_,State) -> {reply,{error,bad_request},State}. -handle_cast({log,Log,Config},#{fd:=Fd} = State) -> - do_log(Fd,Log,Config), +handle_cast({log,LogEvent,Config},#{fd:=Fd} = State) -> + do_log(Fd,LogEvent,Config), {noreply,State}. terminate(Reason,#{fd:=Fd}) -> _ = file:close(Fd), ok. -do_log(Fd,Log,#{formatter:={FModule,FConfig}}) -> - String = FModule:format(Log,FConfig), +do_log(Fd,LogEvent,#{formatter:={FModule,FConfig}}) -> + String = FModule:format(LogEvent,FConfig), io:put_chars(Fd,String). -- cgit v1.2.3