Skip to content

Switch to Erlang logger (from error_logger, which will be eventually removed) #160

@whatyouhide

Description

@whatyouhide

Is your feature request related to a problem? Please describe.

We get a non-negligible amount of logs from the LaunchDarkly SDK, which is great. However, these logs are almost impossible to reliably filter in any way due to the mostly complete lack of metadata.

Bonus: error_logger will be removed in future OTP releases:

The error_logger API still exists, but should only be used by legacy code. It will be removed in a later release.

Describe the solution you'd like

Move to logger, which is really mature by now (~OTP 21).

logger provides ?LOG_* macros that automatically attach a bunch of metadata like module and more, which would make it pretty trivial to build filtering for ldclient logs.

Describe alternatives you've considered

The only metadata exposed by the error_logger logs emitted by ldclient is pid, so there's a possible really convoluted setup where that's used to understand if the process logging comes from the ldclient supervision tree, but it's definitely leaning towards hack territory.

Additional context

This is the log that error_logger emits to the new logger handlers if you hook up one (sorry for Elixir syntax, this is a copypaste):

%{
  level: :notice,
  meta: %{
    error_logger: %{tag: :info_msg},
    gl: #PID<0.3063.0>,
    pid: #PID<0.6181.0>,
    report_cb: #Function<0.79357776/1 in :error_logger.report_to_format>,
    time: 1756894710717633
  },
  msg: {:report,
   %{
     args: [360, 0],
     format: ~c"Received event with ~p flags and ~p segments",
     label: {:error_logger, :info_msg}
   }}
}

Not much we can filter from here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions