-
Notifications
You must be signed in to change notification settings - Fork 118
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
logging library #15
Comments
Hi Dave, Thank you for using xray Go SDK and I would like to hear why you think the logging library is bad? Is it only the configuration bothering you? |
The use of global mutable state is one concern I have. |
I'm using Apex for lambda functions using Go. Apex requires the default output for logging to be STDERR, not STDOUT. It appears that you are setting the console write explicitly. I would be good to have some control over the type of output, to disable it completely would useful during testing. If we could either remove this library and replace it with something more customisable, or just use the stdlib, that would be appreciated. There is not enough control with the SDK in its current form. |
I guess ideally, the SDK would accept an interface for logging, or use the standard "log" pkg if none is specified |
FWIW, as a temporary workaround I wrote the following function, which simply shuts the logger up. import "github.com/cihub/seelog"
func ShutTheFuckUp() {
config := `
<seelog type="sync" minlevel="off">
<outputs><console/></outputs>
</seelog>`
logger, err := seelog.LoggerFromConfigAsBytes([]byte(config))
if err != nil {
panic(err)
}
seelog.ReplaceLogger(logger)
} |
Here are some problems with the logger:
As others have mentioned, a better way is to accept a logger interface. I recommend a custom interface (e.g. with Debug(), Info() and Error() methods), but io.Writer or stdlib *log.Logger would still be a major improvement. You can maintain the current default behavior of logging to stdout. |
The logging library used in this SDK is pretty terrible. I would to use a custom logger or at least have something that isn't using inline XML configuration, its 2017.
The text was updated successfully, but these errors were encountered: