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

Adding Blocking and corresponding checks... #8

Closed
wants to merge 1 commit into from
Closed

Adding Blocking and corresponding checks... #8

wants to merge 1 commit into from

Conversation

sdomino
Copy link
Contributor

@sdomino sdomino commented Jan 12, 2015

...to allow for a blocking configuration

Sometimes you may want the logger to block and guarantee a write to your file rather than background it (for instance in a CLI once you've run a command the program may exit before the logger has a chance to write logs).

Now you would be able to set lumber.Blocking = true to achieve that.

@jcelliott
Copy link
Owner

Have you looked at the Close method? It blocks until all messages have finished writing. This is different from your solution here, but it would work for the example of a CLI program you gave.

@sdomino
Copy link
Contributor Author

sdomino commented Jan 13, 2015

I hadn't seen that, and it does appear to accomplish the same thing.

I only see two minor drawbacks; one being that by using that method the logs fill up with - LOG Closing log now, which isn't a huge issue. The only other potential drawback is that each time you want to os.Exit() you'd need to call log.Close() also, which could be solved by a wrapper anywhere you want to do that.

Anyway, thanks for pointing that out. I'll go ahead and use that as it does exactly what I need, and I can work around the above mentioned points.

Thanks

@jcelliott
Copy link
Owner

Glad that will work for you. Feel free to open a PR or issue for anything else.

@jcelliott jcelliott closed this Jan 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants