Merged
Conversation
Contributor
|
i understand the intent to suppress logging from a library, however do we really want to add two more config options? i.e., why not avoid |
Contributor
Author
|
What would tail.NO_LOGGER be? an io.Writer to /dev/null ? |
Contributor
|
yes. perhaps: NIL_LOGGER=log.New(ioutil.Discard, "", log.LstdFlags)
...
// suppress logging
tail.Config{Logger: tail.NIL_LOGGER ... |
Contributor
Author
|
It feels a bit like using cpu-time for nothing to log to ioutil.Discard. But I can see the simplicity it adds to the configuration of tail. Also, tail doesn't log that much, so there's not that much wasted cputime.. Working on a patch now. |
Contributor
Author
|
Done. |
srid
pushed a commit
that referenced
this pull request
Feb 23, 2014
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The library generates logging output when files are closed or recreated. I didn't want to display this to the user of my program so I added extra options to modify the way
taillogs.There's
Config.Logger, allowing you to set your own Logger (using logfile, or other prefix or flags).And there's
Config.DisableLogging, which disables logging all together..This doesn't change anything for existing users, as Config.Logger is set to the
logpackage's default logger (Log.std) when it's nil.I hope this code will be useful for anyone else out there 😄