Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: log/slog: add multiple handlers support for logger #65954

Open
lxl-renren opened this issue Feb 27, 2024 · 4 comments
Open

proposal: log/slog: add multiple handlers support for logger #65954

lxl-renren opened this issue Feb 27, 2024 · 4 comments
Labels
Milestone

Comments

@lxl-renren
Copy link
Contributor

lxl-renren commented Feb 27, 2024

Proposal Details

Currently slog package a logger only support one handler.
For most language like python, A log module should be sent to multiple targets for output simultaneously for a logger. This feature is necessary, I propose adding multiple handlers support for logger.
cc @golang/proposal-review

@gopherbot gopherbot added this to the Proposal milestone Feb 27, 2024
@seankhliao seankhliao changed the title proposal:log/slog: add multiple handlers support for logger proposal: log/slog: add multiple handlers support for logger Feb 27, 2024
@seankhliao
Copy link
Member

it's unclear why this needs to be in the standard library when it can accomplished as a handler. as the first example I found: https://github.com/samber/slog-multi

@lxl-renren
Copy link
Contributor Author

I agree other third-party library like "slog-multi" accomplished this functionality. Although third-party solutions exist, standardizing this functionality offers several benefits:

  • Consistency and Ease of Use: A standardized approach ensures consistent behavior and API across different projects using the slog package. This reduces the learning curve and simplifies adoption for new users.
  • Discoverability and Integration: Integrating with a standard library feature is often easier. Users don't need to search for and manage dependencies on external packages, making development and maintenance smoother.
  • Quality and Maintenance: Standard library features are actively maintained by the Go team, receiving regular updates, bug fixes, and security patches. This ensures a reliable and well-supported solution for users.

Using third-party library like "slog-multi" may not be maintained consistently, potentially leading to compatibility issues in the future.

@ianlancetaylor
Copy link
Contributor

CC @jba

@jba
Copy link
Contributor

jba commented Mar 1, 2024

@lxl-renren While I agree with you about the values of standardization, I don't think this particular feature warrants it. It is easy enough to write and not needed often enough to justify the added maintenance burden to the Go team.

However, that is just my opinion, and we can and should let the proposal process take its course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Incoming
Development

No branches or pull requests

5 participants