Skip to content

Commit c3ed7bb

Browse files
committed
Improve Logger docs, closes #13313
1 parent cd12b15 commit c3ed7bb

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

lib/logger/lib/logger.ex

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -326,13 +326,14 @@ defmodule Logger do
326326
## Erlang/OTP handlers
327327
328328
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.
332333
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:
336337
337338
config :my_app, :logger, [
338339
{:handler, :file_log, :logger_std_h, %{
@@ -354,7 +355,10 @@ defmodule Logger do
354355
355356
Logger.add_handlers(:my_app)
356357
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
358362
process as the process logging the message/event. This gives developers
359363
flexibility but they should avoid performing any long running action in
360364
such handlers, as it may slow down the action being executed considerably.
@@ -368,7 +372,7 @@ defmodule Logger do
368372
369373
### Filtering
370374
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
372376
that contain a particular string, you could create a module:
373377
374378
defmodule LogFilter do

0 commit comments

Comments
 (0)