@@ -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