logging

package
v0.0.0-...-e171dc0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidLogLevel = errors.New("logger: invalid log level")

ErrInvalidLogLevel is used when an invalid log level has been used.

Functions

func IsEnabledFor

func IsEnabledFor(level Level, module string) bool

IsEnabledFor - Check if given log level is enabled for given module

func SetCustomLogger

func SetCustomLogger(newCustomLogger apilogging.Logger)

SetCustomLogger sets new custom logger which takes over logging operations already created and new logger which are going to be created. Care should be taken while using this method. It is recommended to add Custom loggers before making any loggings.

func SetLevel

func SetLevel(level Level, module string)

SetLevel - setting log level for given module

Types

type DefaultLogger

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

DefaultLogger default underlying logger used by logging.Logger

func (*DefaultLogger) Debug

func (l *DefaultLogger) Debug(args ...interface{})

Debug calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Print.

func (*DefaultLogger) Debugf

func (l *DefaultLogger) Debugf(format string, args ...interface{})

Debugf calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Printf.

func (*DefaultLogger) Debugln

func (l *DefaultLogger) Debugln(args ...interface{})

Debugln calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Println.

func (*DefaultLogger) Error

func (l *DefaultLogger) Error(args ...interface{})

Error calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Print.

func (*DefaultLogger) Errorf

func (l *DefaultLogger) Errorf(format string, args ...interface{})

Errorf calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Printf.

func (*DefaultLogger) Errorln

func (l *DefaultLogger) Errorln(args ...interface{})

Errorln calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Println.

func (*DefaultLogger) Fatal

func (l *DefaultLogger) Fatal(args ...interface{})

Fatal is CRITICAL log followed by a call to os.Exit(1).

func (*DefaultLogger) Fatalf

func (l *DefaultLogger) Fatalf(format string, args ...interface{})

Fatalf is CRITICAL log formatted followed by a call to os.Exit(1).

func (*DefaultLogger) Fatalln

func (l *DefaultLogger) Fatalln(args ...interface{})

Fatalln is CRITICAL log ln followed by a call to os.Exit(1).

func (*DefaultLogger) Info

func (l *DefaultLogger) Info(args ...interface{})

Info calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Print.

func (*DefaultLogger) Infof

func (l *DefaultLogger) Infof(format string, args ...interface{})

Infof calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Printf.

func (*DefaultLogger) Infoln

func (l *DefaultLogger) Infoln(args ...interface{})

Infoln calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Println.

func (*DefaultLogger) Panic

func (l *DefaultLogger) Panic(args ...interface{})

Panic is CRITICAL log followed by a call to panic()

func (*DefaultLogger) Panicf

func (l *DefaultLogger) Panicf(format string, args ...interface{})

Panicf is CRITICAL log formatted followed by a call to panic()

func (*DefaultLogger) Panicln

func (l *DefaultLogger) Panicln(args ...interface{})

Panicln is CRITICAL log ln followed by a call to panic()

func (*DefaultLogger) Print

func (l *DefaultLogger) Print(args ...interface{})

Print calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Print.

func (*DefaultLogger) Printf

func (l *DefaultLogger) Printf(format string, args ...interface{})

Printf calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Printf.

func (*DefaultLogger) Println

func (l *DefaultLogger) Println(args ...interface{})

Println calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Println.

func (*DefaultLogger) Warn

func (l *DefaultLogger) Warn(args ...interface{})

Warn calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Print.

func (*DefaultLogger) Warnf

func (l *DefaultLogger) Warnf(format string, args ...interface{})

Warnf calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Printf.

func (*DefaultLogger) Warnln

func (l *DefaultLogger) Warnln(args ...interface{})

Warnln calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Println.

type Level

type Level int

Level defines all available log levels for log messages.

const (
	CRITICAL Level = iota
	ERROR
	WARNING
	INFO
	DEBUG
)

Log levels.

func GetLevel

func GetLevel(module string) Level

GetLevel - getting log level for given module

func LogLevel

func LogLevel(level string) (Level, error)

LogLevel returns the log level from a string representation.

func (Level) String

func (p Level) String() string

String returns the string representation of a logging level.

type Leveled

type Leveled interface {
	GetLevel(string) Level
	SetLevel(Level, string)
	IsEnabledFor(Level, string) bool
}

Leveled interface is the interface required to be able to add leveled logging.

type Logger

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

Logger basic implementation of api.Logger interface

func GetLogger

func GetLogger(module string) (*Logger, error)

GetLogger creates and returns a Logger object based on the module name.

func NewLogger

func NewLogger(module string) *Logger

NewLogger is like GetLogger but panics if the logger can't be created.

func (*Logger) Debug

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

Debug calls Debug function of underlying logger

func (*Logger) Debugf

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

Debugf calls Debugf function of underlying logger

func (*Logger) Debugln

func (l *Logger) Debugln(args ...interface{})

Debugln calls Debugln function of underlying logger

func (*Logger) Error

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

Error calls Error function of underlying logger

func (*Logger) Errorf

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

Errorf calls Errorf function of underlying logger

func (*Logger) Errorln

func (l *Logger) Errorln(args ...interface{})

Errorln calls Errorln function of underlying logger

func (*Logger) Fatal

func (l *Logger) Fatal(args ...interface{})

Fatal calls Fatal function of underlying logger

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, args ...interface{})

Fatalf calls Fatalf function of underlying logger

func (*Logger) Fatalln

func (l *Logger) Fatalln(args ...interface{})

Fatalln calls Fatalln function of underlying logger

func (*Logger) Info

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

Info calls Info function of underlying logger

func (*Logger) Infof

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

Infof calls Infof function of underlying logger

func (*Logger) Infoln

func (l *Logger) Infoln(args ...interface{})

Infoln calls Infoln function of underlying logger

func (*Logger) Panic

func (l *Logger) Panic(args ...interface{})

Panic calls Panic function of underlying logger

func (*Logger) Panicf

func (l *Logger) Panicf(format string, args ...interface{})

Panicf calls Panicf function of underlying logger

func (*Logger) Panicln

func (l *Logger) Panicln(args ...interface{})

Panicln calls Panicln function of underlying logger

func (*Logger) Print

func (l *Logger) Print(args ...interface{})

Print calls Print function of underlying logger

func (*Logger) Printf

func (l *Logger) Printf(format string, args ...interface{})

Printf calls Printf function of underlying logger

func (*Logger) Println

func (l *Logger) Println(args ...interface{})

Println calls Println function of underlying logger

func (*Logger) Warn

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

Warn calls Warn function of underlying logger

func (*Logger) Warnf

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

Warnf calls Warnf function of underlying logger

func (*Logger) Warnln

func (l *Logger) Warnln(args ...interface{})

Warnln calls Warnln function of underlying logger

Jump to

Keyboard shortcuts

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