@@ -326,13 +326,14 @@ defmodule Logger do
326
326
## Erlang/OTP handlers
327
327
328
328
Handlers represent the ability to integrate into the logging system to
329
- handle each logged message/event. Elixir automatically configures the
330
- default handler, but you can use Erlang's [`:logger`](`:logger`) module
331
- to add other handlers too.
329
+ handle each logged message/event. Elixir's Logger automatically sets a
330
+ default handler based on Erlang's `:logger_std_h`, which you can configure
331
+ using the `:default_handler` boot configuration outlined above. You may
332
+ also attach additional handlers when you boot your application.
332
333
333
- Erlang/OTP handlers must be listed under your own application.
334
- For example, to setup an additional handler, so you write to
335
- console and file:
334
+ To do so, you must list a series of handlers under the `:logger` key
335
+ of your application configuration. For example, to setup an additional
336
+ handler that writes to a file:
336
337
337
338
config :my_app, :logger, [
338
339
{:handler, :file_log, :logger_std_h, %{
@@ -354,7 +355,10 @@ defmodule Logger do
354
355
355
356
Logger.add_handlers(:my_app)
356
357
357
- You can also develop your own handlers. Handlers run in the same
358
+ You can also add, remove, and update handlers at runtime with the help
359
+ of the Erlang's [`:logger`](`:logger`) module.
360
+
361
+ You may also develop your own handlers. Handlers run in the same
358
362
process as the process logging the message/event. This gives developers
359
363
flexibility but they should avoid performing any long running action in
360
364
such handlers, as it may slow down the action being executed considerably.
@@ -368,7 +372,7 @@ defmodule Logger do
368
372
369
373
### Filtering
370
374
371
- You can add filters to Erlang's `:logger` . For example, to filter out logs
375
+ You can add filters to any handler . For example, to filter out logs
372
376
that contain a particular string, you could create a module:
373
377
374
378
defmodule LogFilter do
0 commit comments