NOTE: This project is no longer being updated publicly.
This project is the crux of our stats pipeline. It contains structures to write and rotate logs files in a fast non-blocking manner. The top levelt interface here is the Logger interface. The main implementer of this interface is the FileLogS3Writer.
The FileLogS3Writer is a Logger that is thread safe. The writer will continue to write to a log until a rotate condition is met. The Writer is implemented with a writer stack. Once a file is rotated the FileLogS2Writer maintains an uploader that will upload the file to S3 with a certain name structure.
The Writer Stack maintains two io.WriterClosers. The first is the current WriterCloser. This is the writer that the stack activly writes to. The second if the next WriterCloser. This is the writer that the stack will switch to using immediatly after recieving a rotate. This architecture allows the WriterStack to continue to log messages in a (nearly) nonblocking manner even through rotations.
This project contains a simple example under src/examples
The MIT License (MIT)
Copyright (c) 2014 Twitch Interactive, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.