-
Notifications
You must be signed in to change notification settings - Fork 49
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
Disable stderr logging when file is provided #83
Comments
Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
Finally, remember to use https://discuss.ipfs.io if you just need general support. |
Hm. I agree that it would make more sense if GOLOG_FILE _only_ logged to a file. I thought it did that, actually.
Want to file a patch? It's a breaking change but it should affect pretty much nobody.
Really, we should make it possible to pragmatically re-configure the log target but that's a bigger change.
|
Okay sure will send a patch. "Really, we should make it possible to pragmatically re-configure the log target but that's a bigger change." |
This change adds a Config struct to enable easier reconfiguration of the logger. The default config is still read from the environment in init() but a client of the package can now call SetupLogging again with a custom config to adjust logging after initialization. Allows logging to stderr to be disabled via configuration. Fixes ipfs#83
This change adds a Config struct to enable easier reconfiguration of the logger. The default config is still read from the environment in init() but a client of the package can now call SetupLogging again with a custom config to adjust logging after initialization. Allows logging to stderr to be disabled via configuration. Fixes ipfs#83
This change adds a Config struct to enable easier reconfiguration of the logger. The default config is still read from the environment in init() but a client of the package can now call SetupLogging again with a custom config to adjust logging after initialization. Allows logging to stderr to be disabled via configuration. Fixes ipfs#83
This change adds a Config struct to enable easier reconfiguration of the logger. The default config is still read from the environment in init() but a client of the package can now call SetupLogging again with a custom config to adjust logging after initialization. Allows logging to stderr to be disabled via configuration. Fixes ipfs#83
Another take on ipfs#66 This change introduces a multicore implementation that allows additonal zap cores to be added at runtime. Each core can be configured with distinct encoders and writers which makes it possible to tail the logs in a program using a different log format (e.g. program may log in json but interactive tailing can be in plaintext). This comes at the cost of an additional mutex that must be taken on each write since the destination of the write is mutable. It reworks (and simplifies) the pipe reader implementation added in ipfs#87 and adds a new function NewPipeReaderFormat which creates a pipe reader using a different output format. This change also allows us to reconfigure logging after it has been initialised by swapping out the initial zap core with a newly configured one. This solves the problem that I attempted in ipfs#88 Adds a Config struct to enable easier reconfiguration of the logger. The default config is still read from the environment in init() but a client of the package can now call SetupLogging again with a custom config to adjust logging after initialization. Note that the fix for ipfs#83 is slightly different. If a file is specified using GOLOG_FILE then logging to stderr will be disabled but logging can be configured to write to both file and stderr by calling SetupLogging with the appropriate configuration.
Another take on ipfs#66 This change introduces a multicore implementation that allows additonal zap cores to be added at runtime. Each core can be configured with distinct encoders and writers which makes it possible to tail the logs in a program using a different log format (e.g. program may log in json but interactive tailing can be in plaintext). This comes at the cost of an additional mutex that must be taken on each write since the destination of the write is mutable. It reworks (and simplifies) the pipe reader implementation added in ipfs#87 and adds a new function NewPipeReaderFormat which creates a pipe reader using a different output format. This change also allows us to reconfigure logging after it has been initialised by swapping out the initial zap core with a newly configured one. This solves the problem that I attempted in ipfs#88 Adds a Config struct to enable easier reconfiguration of the logger. The default config is still read from the environment in init() but a client of the package can now call SetupLogging again with a custom config to adjust logging after initialization. Note that the fix for ipfs#83 is slightly different. If a file is specified using GOLOG_FILE then logging to stderr will be disabled but logging can be configured to write to both file and stderr by calling SetupLogging with the appropriate configuration.
@Stebalien This change has broken the ability to have logs go to both a file and to |
The setup by default adds "stderr" to the output paths. I don't see any way we can change this. I don't see zap.Logger also providing a way to change it later.
We have a CLI application, so we would prefer not to show the logs on the console when we configure a log file. Currently, we do a Dup of the stderr to a file to get around this. But Windows doesn't support this that well.
Is there a way to disable the stderr logs?
The text was updated successfully, but these errors were encountered: