otter icon indicating copy to clipboard operation
otter copied to clipboard

Expose newDefaultLogger function

Open hgiasac opened this issue 2 months ago • 1 comments

Description

We may want to use the default logger with a custom slog.Logger, for example, add custom attributes or format. Copying the default logger's code is redundant in those use cases.

Related issue(s)

None

:white_check_mark: Checklist for your Pull Request

Related changes (conditional)

  • Tests

    • [x] If I added new functionality, I added tests covering it.
    • [ ] If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • [x] I checked whether I should update the docs and did so if necessary:
      • README
  • Public contracts

    • [x] My changes doesn't break project license.

Stylistic guide (mandatory)

Before merging (mandatory)

  • [x] Check target branch of PR is set correctly

hgiasac avatar Oct 29 '25 02:10 hgiasac

Hi, sorry for the delayed reply, I've been extremely busy this past week.

It looks good, but I don't like the name NewDefaultLogger. It seems more like just a wrapper over the slog logger. Usually, this is done through something like a plugin system, at the very least, users of zap and zerolog might want the same thing. For example, franz-go.

I'll take a closer look on Saturday.

maypok86 avatar Oct 31 '25 07:10 maypok86