Skip to content

Commit aee33ea

Browse files
author
José Valim
committed
Merge pull request #2638 from jwarwick/logger_docs
Fixing typos in Logger module docs
2 parents 1f725b0 + d8428ba commit aee33ea

File tree

3 files changed

+40
-40
lines changed

3 files changed

+40
-40
lines changed

lib/logger/lib/logger.ex

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ defmodule Logger do
1414
* Formats and truncates messages on the client
1515
to avoid clogging logger backends.
1616
17-
* Alternates between sync and async modes to keep
18-
it performant when required but also apply back-
19-
pressure when under stress.
17+
* Alternates between sync and async modes to remain
18+
performant when required but also apply back-pressure
19+
when under stress.
2020
21-
* Wraps OTP's error_logger to avoid it from
21+
* Wraps OTP's `error_logger` to prevent it from
2222
overflowing.
2323
2424
## Levels
@@ -32,18 +32,18 @@ defmodule Logger do
3232
3333
## Configuration
3434
35-
Logger supports a wide range of configuration.
35+
Logger supports a wide range of configurations.
3636
3737
This configuration is split in three categories:
3838
3939
* Application configuration - must be set before the logger
4040
application is started
4141
4242
* Runtime configuration - can be set before the logger
43-
application is started but changed during runtime
43+
application is started, but may be changed during runtime
4444
4545
* Error logger configuration - configuration for the
46-
wrapper around OTP's error_logger
46+
wrapper around OTP's `error_logger`
4747
4848
### Application configuration
4949
@@ -55,38 +55,38 @@ defmodule Logger do
5555
5656
* `:compile_time_purge_level` - purge all calls that have log level
5757
lower than the configured value at compilation time. This means the
58-
Logger call will be completely removed at compile time, occuring
59-
no overhead at runtime. By default, defaults to `:debug` and only
58+
Logger call will be completely removed at compile time, accruing
59+
no overhead at runtime. Defaults to `:debug` and only
6060
applies to the `Logger.debug`, `Logger.info`, etc style of calls.
6161
6262
### Runtime Configuration
6363
64-
All configuration below can be set via the config files but also
64+
All configuration below can be set via config files but also
6565
changed dynamically during runtime via `Logger.configure/1`.
6666
6767
* `:level` - the logging level. Attempting to log any message
6868
with severity less than the configured level will simply
6969
cause the message to be ignored. Keep in mind that each backend
70-
may have its specific level too.
70+
may have its specific level, too.
7171
72-
* `:utc_log` - when true, uses UTC in logs. By default it uses
73-
local time (i.e. it defaults to false).
72+
* `:utc_log` - when `true`, uses UTC in logs. By default it uses
73+
local time (i.e. it defaults to `false`).
7474
7575
* `:truncate` - the maximum message size to be logged. Defaults
7676
to 8192 bytes. Note this configuration is approximate. Truncated
77-
messages will have " (truncated)" at the end.
77+
messages will have `" (truncated)"` at the end.
7878
7979
* `:sync_threshold` - if the logger manager has more than
80-
`sync_threshold` messages in its queue, logger will change
80+
`sync_threshold` messages in its queue, Logger will change
8181
to sync mode, to apply back-pressure to the clients.
82-
Logger will return to sync mode once the number of messages
83-
in the queue reduce to `sync_threshold * 0.75` messages.
82+
Logger will return to async mode once the number of messages
83+
in the queue is reduced to `sync_threshold * 0.75` messages.
8484
Defaults to 20 messages.
8585
8686
### Error logger configuration
8787
8888
The following configuration applies to the Logger wrapper around
89-
Erlang's error_logger. All the configurations below must be set
89+
Erlang's `error_logger`. All the configurations below must be set
9090
before the logger application starts.
9191
9292
* `:handle_otp_reports` - redirects OTP reports to Logger so
@@ -102,11 +102,11 @@ defmodule Logger do
102102
reached, triggers the error logger to discard messages. This
103103
value must be a positive number that represents the maximum
104104
number of messages accepted per second. Once above this
105-
threshold, the error_logger enters in discard mode for the
106-
remaining of that second. Defaults to 500 messages.
105+
threshold, the `error_logger` enters discard mode for the
106+
remainder of that second. Defaults to 500 messages.
107107
108108
Furthermore, Logger allows messages sent by Erlang's `error_logger`
109-
to be translated into an Elixir format via translators. Translator
109+
to be translated into an Elixir format via translators. Translators
110110
can be dynamically added at any time with the `add_translator/1`
111111
and `remove_translator/1` APIs. Check `Logger.Translator` for more
112112
information.
@@ -135,11 +135,11 @@ defmodule Logger do
135135
following options:
136136
137137
* `:level` - the level to be logged by this backend.
138-
Note though messages are first filtered by the general
138+
Note that messages are first filtered by the general
139139
`:level` configuration in `:logger`
140140
141141
* `:format` - the format message used to print logs.
142-
Defaults to: "$time $metadata[$level] $levelpad$message\n"
142+
Defaults to: `"$time $metadata[$level] $levelpad$message\n"`
143143
144144
* `:metadata` - the metadata to be printed by `$metadata`.
145145
Defaults to an empty list (no metadata)
@@ -161,7 +161,7 @@ defmodule Logger do
161161
162162
See the `IO.ANSI` module for a list of colors and attributes.
163163
164-
Here is an example on how to configure the `:console` in a
164+
Here is an example of how to configure the `:console` backend in a
165165
`config/config.exs` file:
166166
167167
config :logger, :console,
@@ -181,11 +181,11 @@ defmodule Logger do
181181
to your custom backend, as we head into implementation details.
182182
183183
Once Logger starts, it installs all event handlers under
184-
the `:backends` configuration into Logger event manager.
184+
the `:backends` configuration into the Logger event manager.
185185
The event manager and all added event handlers are
186186
automatically supervised by Logger.
187187
188-
Once initialized, the handler should be able to handle events
188+
Once initialized, the handler should be designed to handle events
189189
in the following format:
190190
191191
{level, group_leader,
@@ -214,9 +214,9 @@ defmodule Logger do
214214
It is recommended that backends support at least the following
215215
configuration values:
216216
217-
* level - the logging level for that backend
218-
* format - the logging format for that backend
219-
* metadata - the metadata to include the backend
217+
* `level` - the logging level for that backend
218+
* `format` - the logging format for that backend
219+
* `metadata` - the metadata to include the backend
220220
221221
Check the implementation for `Logger.Backends.Console` for
222222
examples on how to handle the recommendations in this section
@@ -317,7 +317,7 @@ defmodule Logger do
317317
@doc """
318318
Compare log levels.
319319
320-
Receives to log levels and compares the `left`
320+
Receives two log levels and compares the `left`
321321
against `right` and returns `:lt`, `:eq` or `:gt`.
322322
"""
323323
@spec compare_levels(level, level) :: :lt | :eq | :gt
@@ -393,7 +393,7 @@ defmodule Logger do
393393
@doc """
394394
Logs a message.
395395
396-
Developers should rather use the macros `Logger.debug/2`,
396+
Developers should use the macros `Logger.debug/2`,
397397
`Logger.warn/2`, `Logger.info/2` or `Logger.error/2` instead
398398
of this function as they automatically include caller metadata
399399
and can eliminate the Logger call altogether at compile time if
@@ -422,7 +422,7 @@ defmodule Logger do
422422
423423
## Examples
424424
425-
Logger.warn "knob turned too much to the right"
425+
Logger.warn "knob turned too far to the right"
426426
Logger.warn fn -> "expensive to calculate warning" end
427427
428428
"""

lib/logger/lib/logger/formatter.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ defmodule Logger.Formatter do
2020
* `$message` - the log message
2121
* `$level` - the log level
2222
* `$node` - the node that prints the message
23-
* `$metadata` - user controled data presented in "key=val key2=val2" format
23+
* `$metadata` - user controlled data presented in `"key=val key2=val2"` format
2424
* `$levelpad` - set to a single space if level is 4 characters long,
2525
otherwise set to the empty space. Used to align the message after level.
2626
@@ -36,7 +36,7 @@ defmodule Logger.Formatter do
3636
the `Logger.metadata/0` and `Logger.metadata/1` functions. For example,
3737
you can set `Logger.metadata([user_id: 13])` to add user_id metadata
3838
to the current process. The user can configure the backend to chose
39-
which metadata it wants to print and it will replace the $metadata
39+
which metadata it wants to print and it will replace the `$metadata`
4040
value.
4141
"""
4242

@@ -47,10 +47,10 @@ defmodule Logger.Formatter do
4747
Compiles a format string into an array that the `format/5` can handle.
4848
4949
Check the module doc for documentation on the valid parameters. If you
50-
pass nil, it defaults to: `$time $metadata [$level] $levelpad$message\n`
50+
pass `nil`, it defaults to: `$time $metadata [$level] $levelpad$message\n`
5151
5252
If you would like to make your own custom formatter simply pass
53-
`{module, function}` to compile and the rest is handled.
53+
`{module, function}` to `compile/1` and the rest is handled.
5454
5555
iex> Logger.Formatter.compile("$time $metadata [$level] $message\n")
5656
[:time, " ", :metadata, " [", :level, "] ", :message, "\n"]

lib/logger/lib/logger/translator.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ defmodule Logger.Translator do
33
Default translation for Erlang log messages.
44
55
Logger allows developers to rewrite log messages provided by
6-
Erlang applications into a format more compatible to Elixir
7-
log messages by providing translator.
6+
Erlang applications into a format more compatible with Elixir
7+
log messages by providing a translator.
88
99
A translator is simply a tuple containing a module and a function
10-
that can be added and removed via the `add_translator/1` and
11-
`remove_translator/1` functions and is invoked for every Erlang
10+
that can be added and removed via the `Logger.add_translator/1` and
11+
`Logger.remove_translator/1` functions and is invoked for every Erlang
1212
message above the minimum log level with four arguments:
1313
1414
* `min_level` - the current Logger level

0 commit comments

Comments
 (0)