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

Support writing to named loggers #20

Closed
hackquest-grid opened this issue Nov 21, 2020 · 1 comment · Fixed by #21
Closed

Support writing to named loggers #20

hackquest-grid opened this issue Nov 21, 2020 · 1 comment · Fixed by #21
Labels
kind: feature Categorizes as related to a new feature

Comments

@hackquest-grid
Copy link

If I want to use logging for different modules, I would have destinations (like file) depending on the module.

Has it been planned or envisaged to write to a specific logger and not to all managed loggers ?

For example, I would create a console and a file logged for the main part of an application, but also would have a specific logger for a module (let's call it "module"). That would be convenient to have InfoTo(), WarnTo(), etc... for this:

log.NewFileWithName("module", 100, log.FileConfig{
  Level: log.LevelInfo,
  Filename: "module.log"
})

log.InfoTo("module", "log this")
log.WarnTo("module", "warn this")

A complete management of different logger sources with associated destinations would be better, but I think it's a good compromise to add such a functionnality without breaking compatibility.

@unknwon unknwon added the kind: feature Categorizes as related to a new feature label Nov 22, 2020
@unknwon
Copy link
Member

unknwon commented Nov 22, 2020

Implemented in #21.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: feature Categorizes as related to a new feature
Development

Successfully merging a pull request may close this issue.

2 participants