You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My idea is to build a minimalistic logging layer build on top of logrus, having the ability to use a default logger (used by core vinxi package) or alternatively use custom loggers.
In order to make it very simple to use, I think the package should expose a singleton style logger interface, such as (log package consumer side):
From the other side, developers should be able to build and reuse custom loggers with custom formatters and listeners. Possible example:
import"gopkg.in/vinxi/log.v0"varlogConfig:= log.NewConfig(...)
varmyLog:= log.New("myLog", logConfig) // implicitly registeredfuncmain() {
myLog.Printf("Write something: %s", "foo")
myLog.Debug("Debug message")
...// Or you can also retrieve the previously created loggerlog.Logger("myLog").Warm("Got it")
}
The text was updated successfully, but these errors were encountered:
Would you have to do that for every file or just once the main file?
Also, can you only pass the config for the logger or can you pass a custom logger itself?
Generic logging layer is done. We could consider implementing a logger global store as I described above in order to easily register and fetch logger instances from other packages without the instantiation boilerplate.
My opinion is that we could support that in the future when we actually need it more. Should be trivial to support anyway.
My idea is to build a minimalistic logging layer build on top of logrus, having the ability to use a default logger (used by core vinxi package) or alternatively use custom loggers.
In order to make it very simple to use, I think the package should expose a singleton style logger interface, such as (log package consumer side):
From the other side, developers should be able to build and reuse custom loggers with custom formatters and listeners. Possible example:
The text was updated successfully, but these errors were encountered: