Hello,
Im trying to configure elixir logger formatter configuration for the handler i’ve created.
Iam able to do it in elixir version >= 1.15.0 like below:
config :myapp, :logger, [
{:handler, :file_log, :logger_std_h,
%{
config: %{
file: ~c"logs/myapp.log",
filesync_repeat_interval:
System.get_env("FILE_LOG_SYNC_REPEAT_INTERVAL_IN_MS") |> parse_string_to_integer(5000),
file_check:
System.get_env("FILE_LOG_CHECK_INTERVAL_IN_MS") |> parse_string_to_integer(5000),
max_no_bytes:
System.get_env("FILE_LOG_MAX_SIZE_IN_MEGABYTES")
|> parse_string_to_integer(100)
|> megabytes_to_bytes(),
max_no_files: parse_string_to_integer(System.get_env("FILE_LOG_MAX_NO_FILES"), 5),
compress_on_rotate: System.get_env("FILE_LOG_COMPRESS_ON_ROTATE") |> parse_boolean(true)
},
formatter:
Logger.Formatter.new(
format: {MyApp.Logger.JsonFormatter, :format},
metadata: [:module, :function, :line, :request_id, :all]
)
}}
]
but one of the project im working on is using version=v1.12.0, and the logger in elixir=1.12.0 doesnt support
Logger.Formatter.new
function.
I also checked the document for logger handler, it doesnt have handler formatter config metioned.
can anyone help me on this or point me to correct reference?
Thanks !