logger

package
v0.0.0-...-b2761b6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2014 License: GPL-3.0, GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package logger defines a simple logger API with level of logging control.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	// (Re)xpose base Output for logging events.
	Output(calldept int, s string) error
	// Errorf logs an error.
	Errorf(format string, v ...interface{})
	// Fatalf logs an error and exists the program with os.Exit(1).
	Fatalf(format string, v ...interface{})
	// PanicStackf logs a error message and a stacktrace, for use
	// in panic recovery.
	PanicStackf(format string, v ...interface{})
	// Infof logs a info message.
	Infof(format string, v ...interface{})
	// Debugf logs a debug message.
	Debugf(format string, v ...interface{})
}

Logger is a simple logger interface with logging at levels.

func NewSimpleLogger

func NewSimpleLogger(w io.Writer, level string) Logger

NewSimpleLogger creates a logger logging only up to the given level. level can be in order: "error", "info", "debug". It takes a io.Writer.

func NewSimpleLoggerFromMinimalLogger

func NewSimpleLoggerFromMinimalLogger(minLog MinimalLogger, level string) Logger

NewSimpleLoggerFromMinimalLogger creates a logger logging only up to the given level. level can be in order: "error", "info", "debug". It takes a value just implementing stlib Logger.Output().

type MinimalLogger

type MinimalLogger interface {
	Output(calldepth int, s string) error
}

MinimalLogger is the minimal interface required to build a simple logger on top.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL