@@ -226,13 +226,30 @@ defmodule Logger do
226
226
compress_on_rotate: true
227
227
]
228
228
229
- See [`:logger_std_h`](`:logger_std_h`) for all relevant configuration,
230
- including overload protection. Or set `:default_handler` to false to
231
- disable the default logging altogether:
229
+ You can find a complete reference on all handler options
230
+ [on Erlang/OTP docs](`t::logger_handler.config/0`). Here is Elixir's
231
+ default configuration for the default handler:
232
+
233
+ [
234
+ # Do not log messages from other nodes
235
+ filters: [{&:logger_filters.remote_gl/2, :stop}],
236
+ filter_default: :log,
237
+ formatter: &Logger.default_formatter/0,
238
+ level: :all,
239
+ module: :logger_std_h
240
+ ]
241
+
242
+ The `:config` customizes a specific handler module. The default handler
243
+ is [`:logger_std_h`](`:logger_std_h`), which logs to standard IO, and you
244
+ call find all relevant configuration in its module documentation, including
245
+ information overload protection.
246
+
247
+ You may also set `:default_handler` to false to disable the default logging
248
+ altogether:
232
249
233
250
config :logger, :default_handler, false
234
251
235
- How to add new handlers is covered in later sections.
252
+ How to add more handlers besides the default one is covered in later sections.
236
253
237
254
> #### Keywords or maps {: .tip}
238
255
>
@@ -395,8 +412,12 @@ defmodule Logger do
395
412
end
396
413
end
397
414
398
- Then, when you start your application, such as in the
399
- `c:Application.start/2` callback:
415
+ It may return `:log` (to log the message), `:stop` (to not log the
416
+ message), or `:ignore` (to ignore the filter).
417
+
418
+ Then you can attach the filter, either as a primary filter (which
419
+ applies to all handlers), or to a specific handler, when you start
420
+ your application, such as in the `c:Application.start/2` callback:
400
421
401
422
:logger.add_primary_filter(:word_filter, {&LogFilter.filter/2, []})
402
423
@@ -405,7 +426,7 @@ defmodule Logger do
405
426
Prior to Elixir v1.15, custom logging could be achieved with Logger
406
427
backends. The main API for writing Logger backends have been moved to
407
428
the [`:logger_backends`](https://github.com/elixir-lang/logger_backends)
408
- project. However, the backends API are still part of Elixir for backwards
429
+ project. However, the backends API is still part of Elixir for backwards
409
430
compatibility.
410
431
411
432
Important remarks:
0 commit comments