Fix regression where formatter would crash when given chardata (the crash would happen when logging non-ASCII characters)
Module
Logger
76 changes across 35 versions
Changes by version
Reset ansi escapes before newlines in Logger
Accept any enumerable in Logger.metadata/1
The :backends configuration is deprecated, either set the :default_handler to false or start backends in your application start callback
Format :gen_statem reports using Elixir data structures
Include process label in logger events
Ensure translators are persisted across logger restarts
Add Logger.levels/0
Ensure translators are persisted across logger restarts
Do not assume Logger has been loaded at compile-time
Add Logger.add_handlers/1 and Logger.default_formatter/1
Introduce default_formatter and default_handler configuration for Logger which configures Erlang/OTP logger
Add :always_evaluate_messages configuration to Logger
add_backend/2, remove_backend/2, and configure_backend/2 have been deprecated
The :console configuration has been deprecated in favor of :default_formatter
The :backends configuration has been deprecated in favor of Logger.add_handlers/1
Logger.warn/2 is deprecated in favor of Logger.warning/2
Add Logger.put_process_level/2
Deprecate Logger.enable/1 and Logger.disable/1 in favor of Logger.put_process_level/2
Deprecate $levelpad on message formatting
Add Logger.put_application_level/2
Raise clear error message for invalid :compile_time_purge_matching configuration
Fix a bug where Logger would not reset its discard counter under some scenarios
Do not deadlock Logger if handler crashes on sync mode
Add notice, critical, alert, and emergency log levels
Support structured logging by logging maps or keyword lists
Allow level to be set per module with Logger.put_module_level/2
Include erl_level in Logger's metadata
Print metadata for all types that implement String.Chars
warn log level is deprecated in favor of warning
Fix a bug where the Logger formatter would fail when handling unknown metadata values
Properly handle the report_cb/2 option from Erlang
Fix truncation for multi-byte characters
Do not rebroadcast messages from remote nodes as this is now taken care by Erlang's logger
Allow start_options to be configured on Logger's GenEvent
Integrate Elixir's Logger with Erlang/OTP 21+'s logger. This means setting up the logger level in Elixir will automatically change the logger level for Erlang and vice-versa
:compile_time_purge_level application environment configuration has been deprecated in favor of the more general :compile_time_purge_matching config
Deprecate logging non-chardata values
Do not crash translator on poorly formatted supervisor names
Use a decentralized mode computation for Logger which allows overloads to be detected more quickly
Use persistent_term to store configuration whenever available for performance
Don't discard Logger messages from other nodes as to leave a trail on both systems
Make sure Logger v1.8 does not get stuck in discard mode
Allow Logger backends to be dynamically removed when an application is shutting down
Ensure nil metadata is always pruned
Only evaluate Logger macro arguments when the message will be logged
Add :compile_time_purge_matching to purge logger calls that match certain compile time metadata, such as module names and application names
Log to :stderr if a backend fails and there are no other backends
Allow translators to return custom metadata
Return :crash_reason, :initial_call and :registered_name as metadata in crash reports coming from Erlang/OTP
compile_time_purge_level is deprecated in favor of compile_time_purge_matching
Do not crash truncation when truncate is set to infinity
Add :discard_threshold to Logger to help with message queue overflow
Add metadata: :all configuration to log all metadata
Handle changes to crash reports in OTP 20
Use :ansi_color if one is available in metadata
Introduce Logger.reset_metadata/0,1
Stringify truncated function data in Logger
Ensure poorly formatted char data can also be logged by using the replacement character "�" (diamond question mark)
Add file to logger metadata
Support printing pids and refs in Logger metadata
Allow Logger metadata to be removed from pdict by setting it to nil
Add application configuration translator_inspect_opts for logger to customize how state and message are formatted when translating OTP errors and reports
Automatically include the current application in metadata when compiled via Mix
Include metadata in Logger.log/3, use Logger.bare_log/3 for runtime-only, with no metadata behaviour
Handle :undefined arity in Logger.Translator (we get :undefined when a temporary worker of a simple_one_for_one supervisor crashes)
Fix logging with metadata[:function]
Add Logger.enable/1 and Logger.disable/1
Add SASL log forwarding option to Logger
Add $padlevel to option Logger formatter
Backends receive the exact handler value when added, allowing a key to be passed for configuration lookup
Add Logger.flush/0 to flush the Logger (useful for testing)
Persist backends dynamically added or removed via add_backend/2 and remove_backend/2
Metadata is now correctly merged on each Logger.metadata/1 call
Use the Logger PID on :error_logger wrapper to avoid race conditions on shutdown
Add Logger