Categorygithub.com/jamesruan/golf
modulepackage
0.2.0
Repository: https://github.com/jamesruan/golf.git
Documentation: pkg.go.dev

# README

Go LOggering Framework

See documents GoDoc.

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")
}

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
used for signalling the logger to flush and rotate when the logger implements logger.RotateLogger.

# Structs

DirectSink sinks event with Formatter and sink the bytes direct into the Logger.
No description provided by the author
StreamSink sinks event with Formatter and sink the bytes into bufferred stream.
No description provided by the author

# Interfaces

Entry
No description provided by the author