Example #1
0
func ExampleBufferEmpty() {
	handler := NewStreamHandler(logger.LevelDebug, NewTextFormatter("(:level:) :message:"))
	logger := New("MyLogger", NewBufferHandler(handler, logger.LevelWarning))
	logger.Debug("hello debug")
	logger.Info("hello info")

	// Output:
}
Example #2
0
func ExampleSimpleUsage() {
	logger := New("MyLogger", NewStreamHandler(logger.LevelDebug, NewTextFormatter("(:level:) :message:")))
	logger.Debug("hello debug")
	logger.Info("hello info")

	// Output:
	// (DEBUG) hello debug
	// (INFO) hello info
}
Example #3
0
func ExampleBuffer() {
	handler := NewStreamHandler(logger.LevelInfo, NewTextFormatter("(:level:) :message:"))
	logger := New("MyLogger", NewBufferHandler(handler, logger.LevelWarning))
	logger.Debug("hello debug")
	logger.Info("hello info")
	logger.Warning("hello warning")

	// Output:
	// (INFO) hello info
	// (WARNING) hello warning
}