CovenantSQL: github.com/CovenantSQL/CovenantSQL/utils/log Index | Files | Directories

package log

import "github.com/CovenantSQL/CovenantSQL/utils/log"

Index

Package Files

entrylogwrapper.go logwrapper.go nillogger.go

Constants

const (
    // PanicLevel level, highest level of severity. Logs and then calls panic with the
    // message passed to Debug, Info, ...
    PanicLevel logrus.Level = iota
    // FatalLevel level. Logs and then calls `os.Exit(1)`. It will exit even if the
    // logging level is set to Panic.
    FatalLevel
    // ErrorLevel level. Logs. Used for errors that should definitely be noted.
    // Commonly used for hooks to send errors to an error tracking service.
    ErrorLevel
    // WarnLevel level. Non-critical entries that deserve eyes.
    WarnLevel
    // InfoLevel level. General operational entries about what's going on inside the
    // application.
    InfoLevel
    // DebugLevel level. Usually only enabled when debugging. Very verbose logging.
    DebugLevel
)

Variables

var (
    // PkgDebugLogFilter is the log filter
    // if package name exists and log level is more verbose, the log will be dropped
    PkgDebugLogFilter = map[string]logrus.Level{
        "metric": InfoLevel,
        "rpc":    InfoLevel,
    }
    // SimpleLog is the flag of simple log format
    // "Y" for true, "N" for false. defined in `go build`
    SimpleLog = "N"
)

func AddHook Uses

func AddHook(hook logrus.Hook)

AddHook adds a hook to the standard logger hooks.

func Debug Uses

func Debug(args ...interface{})

Debug logs a message at level Debug on the standard logger.

func Debugf Uses

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

Debugf logs a message at level Debug on the standard logger.

func Debugln Uses

func Debugln(args ...interface{})

Debugln logs a message at level Debug on the standard logger.

func Error Uses

func Error(args ...interface{})

Error logs a message at level Error on the standard logger.

func Errorf Uses

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

Errorf logs a message at level Error on the standard logger.

func Errorln Uses

func Errorln(args ...interface{})

Errorln logs a message at level Error on the standard logger.

func Fatal Uses

func Fatal(args ...interface{})

Fatal logs a message at level Fatal on the standard logger.

func Fatalf Uses

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

Fatalf logs a message at level Fatal on the standard logger.

func Fatalln Uses

func Fatalln(args ...interface{})

Fatalln logs a message at level Fatal on the standard logger.

func GetLevel Uses

func GetLevel() logrus.Level

GetLevel returns the standard logger level.

func Info Uses

func Info(args ...interface{})

Info logs a message at level Info on the standard logger.

func Infof Uses

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

Infof logs a message at level Info on the standard logger.

func Infoln Uses

func Infoln(args ...interface{})

Infoln logs a message at level Info on the standard logger.

func Panic Uses

func Panic(args ...interface{})

Panic logs a message at level Panic on the standard logger.

func Panicf Uses

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

Panicf logs a message at level Panic on the standard logger.

func Panicln Uses

func Panicln(args ...interface{})

Panicln logs a message at level Panic on the standard logger.

func ParseLevel Uses

func ParseLevel(lvl string) (logrus.Level, error)

ParseLevel parse the level string and returns the logger level.

func Print Uses

func Print(args ...interface{})

Print logs a message at level Info on the standard logger.

func Printf Uses

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

Printf logs a message at level Info on the standard logger.

func Println Uses

func Println(args ...interface{})

Println logs a message at level Info on the standard logger.

func SetFormatter Uses

func SetFormatter(formatter logrus.Formatter)

SetFormatter sets the standard logger formatter.

func SetLevel Uses

func SetLevel(level logrus.Level)

SetLevel sets the standard logger level.

func SetOutput Uses

func SetOutput(out io.Writer)

SetOutput sets the standard logger output.

func SetStringLevel Uses

func SetStringLevel(lvl string, defaultLevel logrus.Level)

SetStringLevel enforce current log level.

func Warn Uses

func Warn(args ...interface{})

Warn logs a message at level Warn on the standard logger.

func Warnf Uses

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

Warnf logs a message at level Warn on the standard logger.

func Warning Uses

func Warning(args ...interface{})

Warning logs a message at level Warn on the standard logger.

func Warningf Uses

func Warningf(format string, args ...interface{})

Warningf logs a message at level Warn on the standard logger.

func Warningln Uses

func Warningln(args ...interface{})

Warningln logs a message at level Warn on the standard logger.

func Warnln Uses

func Warnln(args ...interface{})

Warnln logs a message at level Warn on the standard logger.

type CallerHook Uses

type CallerHook struct {
    StackLevels []logrus.Level
}

CallerHook defines caller awareness hook for logrus.

func NewCallerHook Uses

func NewCallerHook(stackLevels []logrus.Level) *CallerHook

NewCallerHook creates new CallerHook.

func StandardCallerHook Uses

func StandardCallerHook() *CallerHook

StandardCallerHook is a convenience initializer for LogrusStackHook{} with default args.

func (*CallerHook) Fire Uses

func (hook *CallerHook) Fire(entry *logrus.Entry) error

Fire defines hook event handler.

func (*CallerHook) Levels Uses

func (hook *CallerHook) Levels() []logrus.Level

Levels define hook applicable level.

type Entry Uses

type Entry logrus.Entry

Entry defines alias for logrus entry.

func NewEntry Uses

func NewEntry(logger *Logger) *Entry

NewEntry returns new entry for logrus logger.

func WithError Uses

func WithError(err error) *Entry

WithError creates an entry from the standard logger and adds an error to it, using the value defined in ErrorKey as key.

func WithField Uses

func WithField(key string, value interface{}) *Entry

WithField creates an entry from the standard logger and adds a field to it. If you want multiple fields, use `WithFields`.

Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic on the Entry it returns.

func WithFields Uses

func WithFields(fields Fields) *Entry

WithFields creates an entry from the standard logger and adds multiple fields to it. This is simply a helper for `WithField`, invoking it once for each field.

Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic on the Entry it returns.

func WithTime Uses

func WithTime(t time.Time) *Entry

WithTime add time fields to log entry.

func (*Entry) Debug Uses

func (entry *Entry) Debug(args ...interface{})

Debug record a new debug level log.

func (*Entry) Debugf Uses

func (entry *Entry) Debugf(format string, args ...interface{})

Debugf record a debug level log.

func (*Entry) Debugln Uses

func (entry *Entry) Debugln(args ...interface{})

Debugln record a debug level log.

func (*Entry) Error Uses

func (entry *Entry) Error(args ...interface{})

Error record a new error level log.

func (*Entry) Errorf Uses

func (entry *Entry) Errorf(format string, args ...interface{})

Errorf record a error level log.

func (*Entry) Errorln Uses

func (entry *Entry) Errorln(args ...interface{})

Errorln record a error level log.

func (*Entry) Fatal Uses

func (entry *Entry) Fatal(args ...interface{})

Fatal record a fatal level log.

func (*Entry) Fatalf Uses

func (entry *Entry) Fatalf(format string, args ...interface{})

Fatalf record a fatal level log.

func (*Entry) Fatalln Uses

func (entry *Entry) Fatalln(args ...interface{})

Fatalln record a fatal level log.

func (*Entry) Info Uses

func (entry *Entry) Info(args ...interface{})

Info record a new info level log.

func (*Entry) Infof Uses

func (entry *Entry) Infof(format string, args ...interface{})

Infof record a info level log.

func (*Entry) Infoln Uses

func (entry *Entry) Infoln(args ...interface{})

Infoln record a info level log.

func (*Entry) Panic Uses

func (entry *Entry) Panic(args ...interface{})

Panic record a panic level log.

func (*Entry) Panicf Uses

func (entry *Entry) Panicf(format string, args ...interface{})

Panicf record a panic level log.

func (*Entry) Panicln Uses

func (entry *Entry) Panicln(args ...interface{})

Panicln record a panic level log.

func (*Entry) Print Uses

func (entry *Entry) Print(args ...interface{})

Print record a new non-level log.

func (*Entry) Printf Uses

func (entry *Entry) Printf(format string, args ...interface{})

Printf record a new non-level log.

func (*Entry) Println Uses

func (entry *Entry) Println(args ...interface{})

Println record a non-level log.

func (*Entry) String Uses

func (entry *Entry) String() (string, error)

Returns the string representation from the reader and ultimately the formatter.

func (*Entry) Warn Uses

func (entry *Entry) Warn(args ...interface{})

Warn record a new warning level log.

func (*Entry) Warnf Uses

func (entry *Entry) Warnf(format string, args ...interface{})

Warnf record a warning level log.

func (*Entry) Warning Uses

func (entry *Entry) Warning(args ...interface{})

Warning record a new warning level log.

func (*Entry) Warningf Uses

func (entry *Entry) Warningf(format string, args ...interface{})

Warningf record a warning level log.

func (*Entry) Warningln Uses

func (entry *Entry) Warningln(args ...interface{})

Warningln record a warning level log.

func (*Entry) Warnln Uses

func (entry *Entry) Warnln(args ...interface{})

Warnln record a warning level log.

func (*Entry) WithError Uses

func (entry *Entry) WithError(err error) *Entry

WithError adds an error as single field (using the key defined in ErrorKey) to the Entry.

func (*Entry) WithField Uses

func (entry *Entry) WithField(key string, value interface{}) *Entry

WithField add a single field to the Entry.

func (*Entry) WithFields Uses

func (entry *Entry) WithFields(fields Fields) *Entry

WithFields add a map of fields to the Entry.

func (*Entry) WithTime Uses

func (entry *Entry) WithTime(t time.Time) *Entry

WithTime overrides the time of the Entry.

type Fields Uses

type Fields logrus.Fields

Fields defines the field map to pass to `WithFields`.

type Logger Uses

type Logger logrus.Logger

Logger wraps logrus logger type.

func StandardLogger Uses

func StandardLogger() *Logger

StandardLogger returns the standard logger.

func (*Logger) Printf Uses

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

Printf logs a message at level Info on the standard logger.

type NilFormatter Uses

type NilFormatter struct{}

NilFormatter just discards the log entry.

func (*NilFormatter) Format Uses

func (f *NilFormatter) Format(entry *logrus.Entry) ([]byte, error)

Format just return nil, nil for discarding log entry.

type NilWriter Uses

type NilWriter struct{}

NilWriter just discards the log entry.

func (*NilWriter) Write Uses

func (w *NilWriter) Write(p []byte) (n int, err error)

Write just return 0, nil for discarding log entry.

Directories

PathSynopsis
debug

Package log imports 7 packages (graph) and is imported by 67 packages. Updated 2019-03-20. Refresh now. Tools for package owners.