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
{{ message }}
This repository has been archived by the owner on Aug 12, 2019. It is now read-only.
As soon as I run this function I lose both logs in that file and on Stdout ...
I think these are actually 3 separate problems.
The first is that os.Create() truncates the file. You can use os.OpenFile() to open for writing without truncate. To resolve this on the sawmill side, I could add a helper function to the handler/writer package. Such as writer.NewFileAppender(path string, mode int). Which would open the file for appending, creating it only if it doesn't exist.
Then, the bufio.NewWriter() is creating an async write buffer, that doesn't get flushed automatically. So unless an explicit call to logfileWriter.Flush() is made, log entries may be missing. For this, I might be open to adding a Stop() method to the handler interface, this could be called when a handler is removed from the logger (logger is shut down). The handler/writer package would then make sure Close() is called on the underlying writer which would flush the buffer.
In regards to losing STDOUT, sm.NewLogger() creates a completely empty logger. It doesn't output to STDOUT or anything. If you call InitStdStreams(), that will set up STDOUT/STDERR on the logger.
Lastly, I can add some more examples which show use cases such as creating a custom logger which writes to multiple destinations.
I'll take a look at these things this weekend (maybe sooner if I have some time).
Hi,
I am interested in configuring sawmill to log at the same time to
Using only the provided api docs doesn't help me that much when things go bad.
For example:
As soon as I run this function I lose both logs in that file and on Stdout ...
The text was updated successfully, but these errors were encountered: