log

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2019 License: Apache-2.0 Imports: 4 Imported by: 144

Documentation

Overview

Package log includes logging related manipulations.

 log.SetLevel("debug")
	logger := log.NewLogger(os.Stdout)

 logger.Trace("trace message)
	logger.Debug("debug message")
	logger.Info("info message")
	logger.Warn("warning message")
	logger.Error("error message")

	logger.Errorf("formatted %s message", "error")

Index

Constants

View Source
const (
	Off = iota
	Trace
	Debug
	Info
	Warn
	Error
)

Logging level.

Variables

This section is empty.

Functions

func SetLevel

func SetLevel(level string)

SetLevel sets the logging level of all loggers.

Types

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger represents a simple logger with level. The underlying logger is the standard Go logging "log".

func NewLogger

func NewLogger(out io.Writer) *Logger

NewLogger creates a logger.

func (*Logger) Debug

func (l *Logger) Debug(v ...interface{})

Debug prints debug level message.

func (*Logger) Debugf

func (l *Logger) Debugf(format string, v ...interface{})

Debugf prints debug level message with format.

func (*Logger) Error

func (l *Logger) Error(v ...interface{})

Error prints error level message.

func (*Logger) Errorf

func (l *Logger) Errorf(format string, v ...interface{})

Errorf prints error level message with format.

func (*Logger) Info

func (l *Logger) Info(v ...interface{})

Info prints info level message.

func (*Logger) Infof

func (l *Logger) Infof(format string, v ...interface{})

Infof prints info level message with format.

func (*Logger) IsDebugEnabled

func (l *Logger) IsDebugEnabled() bool

IsDebugEnabled determines whether the debug level is enabled.

func (*Logger) IsTraceEnabled

func (l *Logger) IsTraceEnabled() bool

IsTraceEnabled determines whether the trace level is enabled.

func (*Logger) IsWarnEnabled

func (l *Logger) IsWarnEnabled() bool

IsWarnEnabled determines whether the debug level is enabled.

func (*Logger) SetLevel

func (l *Logger) SetLevel(level string)

SetLevel sets the logging level of a logger.

func (*Logger) Trace

func (l *Logger) Trace(v ...interface{})

Trace prints trace level message.

func (*Logger) Tracef

func (l *Logger) Tracef(format string, v ...interface{})

Tracef prints trace level message with format.

func (*Logger) Warn

func (l *Logger) Warn(v ...interface{})

Warn prints warning level message.

func (*Logger) Warnf

func (l *Logger) Warnf(format string, v ...interface{})

Warn prints warning level message with format.

Jump to

Keyboard shortcuts

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