예제 #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:
}
예제 #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
}
예제 #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
}