log is a simple logging library for Google Go.
For full package documentation, see the GoDoc link above.
// Create and open a file.
f, err := os.Create("myLogFile.log")
if err != nil {
panic(err)
}
defer f.Close()
// Add the file as an output.
log.AddOutput(f)
// Create a new logger.
logger := log.NewLogger("MyLogger", log.Info)
logger.Info("This message will appear in the log file")
// Add stdout as an output.
log.AddOutput(os.Stdout)
// Create a new logger.
logger := log.NewLogger("MyLogger", log.Info)
logger.Info("This message will appear in stdout")
log is licensed under the MIT license.