# README
Go LOggering Framework
Features and TODOs
-
Entry -> Handler... -> Logger architecture where Logger runs in a separate goroutine and allows asynchronous logging.
-
Flexible handlers that can broadcast and forward logging events to logger in different condition.
-
Multi-goroutine safe handlers that can change event route condition online.
-
Support file based output and rotate with lumberjack, response to os.Signal for triggered rotate.
-
Support network output with file based spooling.
-
Console formatter
- Colorized.
- Call stack print.
- Calling position (file:line).
- Line-bufferred output.
Example
import (
"github.com/jamesruan/golf"
"github.com/jamesruan/golf/event"
)
func main() {
logger := golf.DefaultEntry
logger.Infof("Hello, World!")
topic_logger := golf.NewTopicEntry("mytopic", golf.DefaultSink)
topic_logger.Infof("log with topic")
field_logger := topic_logger.WithFields(event.Field{
Name: "field",
Value: "field_value",
})
field_logger.Infof("log with field")
field_logger.Fatalf("make sure log is flushed")
}