Skip to content

Commit 92d21c8

Browse files
committed
Bump version
1 parent ffb3643 commit 92d21c8

File tree

2 files changed

+14
-25
lines changed

2 files changed

+14
-25
lines changed

README.md

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Add `logger_json` to your list of dependencies in `mix.exs`:
2727
def deps do
2828
[
2929
# ...
30-
{:logger_json, "~> 6.1"}
30+
{:logger_json, "~> 7.0"}
3131
# ...
3232
]
3333
end
@@ -76,20 +76,11 @@ formatter = LoggerJSON.Formatters.Basic.new(%{metadata: {:all_except, [:conn]}})
7676
:logger.update_handler_config(:default, :formatter, formatter)
7777
```
7878

79-
It is possible to set during compile-time the JSON encoder:
79+
By default, `LoggerJSON` is using `Jason` as the JSON encoder. If you use Elixir 1.18 or later, you can
80+
use the built-in `JSON` module as the encoder. To do this, you need to set the `:encoder` option in your
81+
`config.exs` file. This setting is only available at compile-time:
8082

81-
```elixir
82-
config :logger_json, encoder: Jason
83-
```
84-
85-
For Elixir 1.18+, `JSON` is available and can be set as the encoder:
86-
87-
```elixir
88-
config :logger_json, encoder: JSON
89-
```
90-
91-
For retro-compatibility, `Jason` is the default encoder. Make sure to add it to the project
92-
dependencies if the encoder will not be changed.
83+
config :logger_json, encoder: JSON
9384

9485
## Docs
9586

lib/logger_json.ex

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ defmodule LoggerJSON do
2424
def deps do
2525
[
2626
# ...
27-
{:logger_json, "~> 6.1"}
27+
{:logger_json, "~> 7.0"}
2828
# ...
2929
]
3030
end
@@ -43,7 +43,9 @@ defmodule LoggerJSON do
4343
4444
## Configuration
4545
46-
Configuration can be set using 2nd element of the tuple of the `:formatter` option in `Logger` configuration.
46+
Configuration can be set using `new/1` helper of the formatter module,
47+
or by setting the 2nd element of the `:formatter` option tuple in `Logger` configuration.
48+
4749
For example in `config.exs`:
4850
4951
config :logger, :default_handler,
@@ -54,17 +56,12 @@ defmodule LoggerJSON do
5456
formatter = LoggerJSON.Formatters.Basic.new(metadata: {:all_except, [:conn]})
5557
:logger.update_handler_config(:default, :formatter, formatter)
5658
57-
It is possible to set during compile-time the JSON encoder:
58-
59-
config :logger_json, encoder: Jason
60-
61-
For Elixir 1.18+, `JSON` is available and can be set as the encoder:
59+
By default, `LoggerJSON` is using `Jason` as the JSON encoder. If you use Elixir 1.18 or later, you can
60+
use the built-in `JSON` module as the encoder. To do this, you need to set the `:encoder` option in your
61+
`config.exs` file. This setting is only available at compile-time:
6262
6363
config :logger_json, encoder: JSON
6464
65-
For retro-compatibility, `Jason` is the default encoder. Make sure to add it to the project
66-
dependencies if the encoder will not be changed.
67-
6865
### Shared Options
6966
7067
Some formatters require additional configuration options. Here are the options that are common for each formatter:
@@ -77,7 +74,8 @@ defmodule LoggerJSON do
7774
* `:metadata` - a list of metadata keys to include in the log entry. By default, no metadata is included.
7875
If `:all`is given, all metadata is included. If `{:all_except, keys}` is given, all metadata except
7976
the specified keys is included. If `{:from_application_env, {app, module}, path}` is given, the metadata is fetched from
80-
the application environment (eg. `{:from_application_env, {:logger, :default_formatter}, [:metadata]}`) on each logged message.
77+
the application environment (eg. `{:from_application_env, {:logger, :default_formatter}, [:metadata]}`) during the
78+
configuration initialization.
8179
8280
* `:redactors` - a list of tuples, where first element is the module that implements the `LoggerJSON.Redactor` behaviour,
8381
and the second element is the options to pass to the redactor module. By default, no redactors are used.

0 commit comments

Comments
 (0)