feat: Migrate from error_logger to OTP logger module#173
Open
kinyoklion wants to merge 3 commits intomainfrom
Open
feat: Migrate from error_logger to OTP logger module#173kinyoklion wants to merge 3 commits intomainfrom
kinyoklion wants to merge 3 commits intomainfrom
Conversation
Replace all error_logger calls (info_msg, warning_msg, error_msg) with
their logger equivalents (logger:info, logger:warning, logger:error)
across 18 source files and 3 test files.
All logger calls include #{domain => [ldclient]} metadata, enabling
users to filter SDK logs using standard logger configuration. The logger
module also automatically attaches module, function, and line metadata.
This addresses GitHub issue #160. The error_logger module is marked for
eventual removal from OTP, and logger (available since OTP 21) is the
recommended replacement. All supported OTP versions (24+) include logger.
Migration notes for users:
- Users with custom error_logger report handlers that specifically
capture SDK logs should switch to logger handlers instead. Example:
logger:add_handler(my_handler, my_module, #{
filter_default => stop,
filters => [{ldclient_only,
{fun logger_filters:domain/2, {log, sub, [ldclient]}}}]
})
- Elixir users benefit automatically: SDK logs now appear as native
Elixir Logger events with proper metadata instead of wrapped
error_logger reports.
- No public API changes. This is an internal logging infrastructure
change only.
The default logger_formatter templates already append newlines, so trailing ~n in format strings produced double-newlines. Additionally, one 2-argument logger:info call had ~n in a literal string where it would not be expanded at all (unlike error_logger which processed all strings through io_lib:format).
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Pre-existing bug: the format string used C-style %p instead of Erlang's ~p for the Uri argument. This caused io_lib:format to fail at runtime, silently losing the "Failed to connect to update server" warning message.
keelerm84
approved these changes
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Replace all error_logger calls (info_msg, warning_msg, error_msg) with their logger equivalents (logger:info, logger:warning, logger:error).
All logger calls include #{domain => [ldclient]} metadata, enabling users to filter SDK logs using standard logger configuration. The logger module also automatically attaches module, function, and line metadata.
This addresses GitHub issue #160. The error_logger module is marked for eventual removal from OTP, and logger (available since OTP 21) is the recommended replacement. All supported OTP versions (24+) include logger.
I am concerned about one situation. Users with custom error_logger report handlers that specifically capture SDK logs should switch to logger handlers instead. Example:
Basically if they were already working around the fact we didn't support logger, then that workaround would break.
Note
Medium Risk
Mostly a mechanical logging migration, but it can change log routing/formatting and may break consumers relying on
error_loggerreport handlers to capture SDK logs.Overview
Migrates SDK logging from
error_logger(info_msg/warning_msg/error_msg) to OTPlogger(info/warning/error) across client, evaluation, update processors, event pipeline, and storage backends.All new log calls attach
#{domain => [ldclient]}metadata to enable domain-based filtering, and the test suite is updated to capture logs via a customloggerhandler instead of anerror_loggerreport handler.Written by Cursor Bugbot for commit a7d7962. This will update automatically on new commits. Configure here.