diff options
Diffstat (limited to 'lib/kernel/doc/src/logger_filters.xml')
-rw-r--r-- | lib/kernel/doc/src/logger_filters.xml | 164 |
1 files changed, 90 insertions, 74 deletions
diff --git a/lib/kernel/doc/src/logger_filters.xml b/lib/kernel/doc/src/logger_filters.xml index f92181ea3f..90f1fcc270 100644 --- a/lib/kernel/doc/src/logger_filters.xml +++ b/lib/kernel/doc/src/logger_filters.xml @@ -36,15 +36,15 @@ <modulesummary>Filters to use with Logger.</modulesummary> <description> - <p>All functions exported from this module can be used as logger + <p>All functions exported from this module can be used as primary or handler - filters. See <seealso marker="logger#add_logger_filter-2"> - <c>logger:add_logger_filter/2</c></seealso> + filters. See <seealso marker="logger#add_primary_filter-2"> + <c>logger:add_primary_filter/2</c></seealso> and <seealso marker="logger#add_handler_filter-3"> <c>logger:add_handler_filter/3</c></seealso> for more information about how filters are added.</p> - <p>Filters are removed with <seealso marker="logger#remove_logger_filter-1"> - <c>logger:remove_logger_filter/1</c></seealso> + <p>Filters are removed with <seealso marker="logger#remove_primary_filter-1"> + <c>logger:remove_primary_filter/1</c></seealso> and <seealso marker="logger#remove_handler_filter-2"> <c>logger:remove_handler_filter/2</c></seealso>.</p> </description> @@ -64,18 +64,18 @@ <p>A domain field must be a list of atoms, creating smaller and more specialized domains as the list grows longer. The - biggest domain is <c>[]</c>, which comprices all - possible domains.</p> + greatest domain is <c>[]</c>, which comprises all possible + domains.</p> <p>For example, consider the following domains:</p> <pre> -D1 = [beam,erlang,otp] -D2 = [beam,erlang,otp,sasl]</pre> +D1 = [otp] +D2 = [otp, sasl]</pre> - <p><c>D1</c> is the biggest of the two, and is said to be a + <p><c>D1</c> is the greatest of the two, and is said to be a super-domain of <c>D2</c>. <c>D2</c> is a sub-domain <c>D1</c>. Both <c>D1</c> and <c>D2</c> are - sub-domains of <c>[]</c></p> + sub-domains of <c>[]</c>.</p> <p>The above domains are used for logs originating from Erlang/OTP. D1 specifies that the log event comes from @@ -86,50 +86,50 @@ D2 = [beam,erlang,otp,sasl]</pre> <p>The <c><anno>Extra</anno></c> parameter to the <c>domain/2</c> function is specified when adding the - filter via <seealso marker="logger#add_logger_filter-2"> - <c>logger:add_logger_filter/2</c></seealso> + filter via <seealso marker="logger#add_primary_filter-2"> + <c>logger:add_primary_filter/2</c></seealso> or <seealso marker="logger#add_handler_filter-3"> <c>logger:add_handler_filter/3</c></seealso>.</p> - <p>The filter compares the value of the <c>domain</c> field - in the log event's metadata (<c>Domain</c>) - to <c><anno>MatchDomain</anno></c> as follows:</p> + <p>The filter compares the value of the <c>domain</c> field in + the log event's metadata (<c>Domain</c>) against + <c><anno>MatchDomain</anno></c>. The filter matches if the + value of <c>Compare</c> is:</p> <taglist> - <tag><c><anno>Compare</anno> = sub</c></tag> + <tag><c>sub</c></tag> <item> - <p>The filter matches if <c>Domain</c> is equal to or - a sub-domain of <c>MatchDomain</c>, that is, - if <c>MatchDomain</c> is a prefix of <c>Domain</c>.</p> + <p>and <c>Domain</c> is equal to or a sub-domain + of <c>MatchDomain</c>, that is, if <c>MatchDomain</c> is + a prefix of <c>Domain</c>.</p> </item> - <tag><c><anno>Compare</anno> = super</c></tag> + <tag><c>super</c></tag> <item> - <p>The filter matches if <c>Domain</c> is equal to or a - super-domain of <c>MatchDomain</c>, that is, - if <c>Domain</c> is a prefix of <c>MatchDomain</c>.</p> + <p>and <c>Domain</c> is equal to or a super-domain + of <c>MatchDomain</c>, that is, if <c>Domain</c> is a + prefix of <c>MatchDomain</c>.</p> </item> - <tag><c><anno>Compare</anno> = equal</c></tag> + <tag><c>equal</c></tag> <item> - <p>The filter matches if <c>Domain</c> is equal - to <c>MatchDomain</c>.</p> + <p>and <c>Domain</c> is equal to <c>MatchDomain</c>.</p> </item> - <tag><c><anno>Compare</anno> = not_equal</c></tag> + <tag><c>not_equal</c></tag> <item> - <p>The filter matches if <c>Domain</c> is not equal - to <c>MatchDomain</c>, or if there is no domain field in - metadata.</p> + <p>and <c>Domain</c> differs from <c>MatchDomain</c>, or + if there is no domain field in metadata.</p> </item> - <tag><c><anno>Compare</anno> = undefined</c></tag> - <item><p>The filter matches if there is no domain field in - metadata. In this case <c><anno>MatchDomain</anno></c> - must be set to <c>[]</c>.</p> + <tag><c>undefined</c></tag> + <item> + <p>and there is no domain field in metadata. In this + case <c><anno>MatchDomain</anno></c> must be set + to <c>[]</c>.</p> </item> </taglist> - <p>If the filter matches and <c><anno>Action</anno> = log</c>, - the log event is allowed. If the filter matches - and <c><anno>Action</anno> = stop</c>, the log event is - stopped.</p> + <p>If the filter matches and <c><anno>Action</anno></c> is + <c>log</c>, the log event is allowed. If the filter matches + and <c><anno>Action</anno></c> is <c>stop</c>, the log event + is stopped.</p> <p>If the filter does not match, it returns <c>ignore</c>, meaning that other filters, or the value of the @@ -137,16 +137,16 @@ D2 = [beam,erlang,otp,sasl]</pre> event is allowed or not.</p> <p>Log events that do not contain any domain field, match only - when <c><anno>Compare</anno> = undefined</c> - or <c><anno>Compare</anno> = not_equal</c>.</p> + when <c><anno>Compare</anno></c> is equal + to <c>undefined</c> or <c>not_equal</c>.</p> - <p>Example: stop all events with - domain <c>[beam,erlang,otp,sasl|_]</c></p> + <p>Example: stop all events with domain <c>[otp, + sasl | _]</c></p> <code> -logger:set_handler_config(h1,filter_default,log). % this is the default -Filter = {fun logger_filters:domain/2,{stop,sub,[beam,erlang,otp,sasl]}}. -logger:add_handler_filter(h1,no_sasl,Filter). +logger:set_handler_config(h1, filter_default, log). % this is the default +Filter = {fun logger_filters:domain/2, {stop, sub, [otp, sasl]}}. +logger:add_handler_filter(h1, no_sasl, Filter). ok</code> </desc> </func> @@ -157,34 +157,44 @@ ok</code> <desc> <p>This filter provides a way of filtering log events based on the log level. It matches log events by comparing the - log level with a predefined <c>MatchLevel</c></p> + log level with a specified <c>MatchLevel</c></p> <p>The <c><anno>Extra</anno></c> parameter is specified when adding the filter - via <seealso marker="logger#add_logger_filter-2"> - <c>logger:add_logger_filter/2</c></seealso> + via <seealso marker="logger#add_primary_filter-2"> + <c>logger:add_primary_filter/2</c></seealso> or <seealso marker="logger#add_handler_filter-3"> <c>logger:add_handler_filter/3</c></seealso>.</p> <p>The filter compares the value of the event's log level (<c>Level</c>) to <c><anno>MatchLevel</anno></c> by calling <seealso marker="logger#compare_levels-2"> - <c>logger:compare_levels(Level,MatchLevel) -> CmpRet</c></seealso>. It - matches the event if:</p> - - <list> - <item><c>CmpRet = eq</c> and <c><anno>Operator</anno> = - eq | lteq | gteq</c></item> - <item><c>CmpRet = lt</c> and <c><anno>Operator</anno> = - lt | lteq | neq</c></item> - <item><c>CmpRet = gt</c> and <c><anno>Operator</anno> = - gt | gteq | neq</c></item> - </list> - - <p>If the filter matches and <c><anno>Action</anno> = - log</c>, the log event is allowed. If the filter matches - and <c><anno>Action</anno> = stop</c>, the log event is - stopped.</p> + <c>logger:compare_levels(Level, MatchLevel)</c></seealso>. + The filter matches if the value + of <c><anno>Operator</anno></c> is:</p> + + <taglist> + <tag><c>neq</c></tag> + <item><p>and the compare function returns <c>lt</c> + or <c>gt</c>.</p></item> + <tag><c>eq</c></tag> + <item><p>and the compare function returns <c>eq</c>.</p></item> + <tag><c>lt</c></tag> + <item><p>and the compare function returns <c>lt</c>.</p></item> + <tag><c>gt</c></tag> + <item><p>and the compare function returns <c>gt</c>.</p></item> + <tag><c>lteq</c></tag> + <item><p>and the compare function returns <c>lt</c> + or <c>eq</c>.</p></item> + <tag><c>gteq</c></tag> + <item><p>and the compare function returns <c>gt</c> + or <c>eq</c>.</p></item> + </taglist> + + <p>If the filter matches and <c><anno>Action</anno></c> is + <c>log</c>, the log event is allowed. If the filter + matches and <c><anno>Action</anno></c> is <c>stop</c>, the + log event is stopped.</p> <p>If the filter does not match, it returns <c>ignore</c>, meaning that other filters, or the value of the @@ -194,9 +204,9 @@ ok</code> <p>Example: only allow debug level log events</p> <code> -logger:set_handler_config(h1,filter_default,stop). -Filter = {fun logger_filters:level/2,{log,eq,debug}}. -logger:add_handler_filter(h1,debug_only,Filter). +logger:set_handler_config(h1, filter_default, stop). +Filter = {fun logger_filters:level/2, {log, eq, debug}}. +logger:add_handler_filter(h1, debug_only, Filter). ok</code> </desc> </func> @@ -208,9 +218,9 @@ ok</code> <p>This filter matches all progress reports from <c>supervisor</c> and <c>application_controller</c>.</p> - <p>If <c><anno>Extra</anno> = log</c>, the progress reports - are allowed. If <c><anno>Extra</anno> = stop</c>, the - progress reports are stopped.</p> + <p>If <c><anno>Extra</anno></c> is <c>log</c>, the progress + reports are allowed. If <c><anno>Extra</anno></c> + is <c>stop</c>, the progress reports are stopped.</p> <p>The filter returns <c>ignore</c> for all other log events.</p> </desc> @@ -223,9 +233,9 @@ ok</code> <p>This filter matches all events originating from a process that has its group leader on a remote node.</p> - <p>If <c><anno>Extra</anno> = log</c>, the matching events - are allowed. If <c><anno>Extra</anno> = stop</c>, the - matching events are stopped.</p> + <p>If <c><anno>Extra</anno></c> is <c>log</c>, the matching + events are allowed. If <c><anno>Extra</anno></c> + is <c>stop</c>, the matching events are stopped.</p> <p>The filter returns <c>ignore</c> for all other log events.</p> </desc> @@ -233,6 +243,12 @@ ok</code> </funcs> + <section> + <title>See Also</title> + <p> + <seealso marker="logger"><c>logger(3)</c></seealso> + </p> + </section> </erlref> |