log

package
v0.0.0-...-82d568a Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2018 License: Apache-2.0 Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Levels = [...]string{
	"INFO",
	"DEBUG",
}

Levels defines a pseudo enum of log levels

View Source
var ZapLevelMapping = map[Level]zapcore.Level{
	INFO:  zap.InfoLevel,
	DEBUG: zap.DebugLevel,
}

ZapLevelMapping maps Zap log levels to node-reaper log levels

Functions

This section is empty.

Types

type Dummy

type Dummy struct{}

Dummy provides a dummy logger implementation

func (*Dummy) Debug

func (z *Dummy) Debug(args ...interface{})

Debug logs with level Debug

func (*Dummy) Debugf

func (z *Dummy) Debugf(template string, args ...interface{})

Debugf formats and logs with level Debug

func (*Dummy) Error

func (z *Dummy) Error(args ...interface{})

Error logs with level Error

func (*Dummy) Errorf

func (z *Dummy) Errorf(template string, args ...interface{})

Errorf formats and logs with level Error

func (*Dummy) Info

func (z *Dummy) Info(args ...interface{})

Info logs with level Info

func (*Dummy) Infof

func (z *Dummy) Infof(template string, args ...interface{})

Infof formats and logs with level Info

func (Dummy) New

func (z Dummy) New(level Level) (Logger, error)

New creates a Dummy logger

func (*Dummy) Warn

func (z *Dummy) Warn(args ...interface{})

Warn logs with level Warn

func (*Dummy) Warnf

func (z *Dummy) Warnf(template string, args ...interface{})

Warnf formats and logs with level Warn

func (*Dummy) Warningf

func (z *Dummy) Warningf(template string, args ...interface{})

Warningf formats and logs with level Warn

func (Dummy) WithFields

func (z Dummy) WithFields(fields []Field, prefix string, suffix string) Logger

WithFields returns a clone of the Dummy logger

type Field

type Field struct {
	Field string
	Width uint
}

Field defines a log field with a width

type Level

type Level int

Level is a pseudo enum for setting log levels

const (
	INFO Level = iota + 1
	DEBUG
)

Sets the accepted log levels

func StringToLogLevel

func StringToLogLevel(l string) (Level, error)

StringToLogLevel converts a log level in string format to the corresponding int value

func (Level) String

func (ll Level) String() string

String converts a log level to a string

type Logger

type Logger interface {
	Debug(...interface{})
	Debugf(string, ...interface{})

	Info(...interface{})
	Infof(string, ...interface{})

	Warn(...interface{})
	Warnf(string, ...interface{})
	Warningf(string, ...interface{})

	Error(...interface{})
	Errorf(string, ...interface{})

	New(Level) (Logger, error)
	WithFields(fields []Field, prefix string, suffix string) Logger
}

Logger is an interface that needs to be implemented in order to log.

type Zap

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

Zap provides a sugared logger implementation based on zap

func (*Zap) Debug

func (z *Zap) Debug(args ...interface{})

Debug logs with level Debug

func (*Zap) Debugf

func (z *Zap) Debugf(template string, args ...interface{})

Debugf formats and logs with level Debug

func (*Zap) Error

func (z *Zap) Error(args ...interface{})

Error logs with level Error

func (*Zap) Errorf

func (z *Zap) Errorf(template string, args ...interface{})

Errorf formats and logs with level Error

func (*Zap) Info

func (z *Zap) Info(args ...interface{})

Info logs with level Info

func (*Zap) Infof

func (z *Zap) Infof(template string, args ...interface{})

Infof formats and logs with level Info

func (Zap) New

func (z Zap) New(level Level) (Logger, error)

New creates an opinionated zap logger

func (Zap) NewWithConfig

func (z Zap) NewWithConfig(cfg zap.Config) (Logger, error)

NewWithConfig creates a zap logger with the provided zap config

func (*Zap) Warn

func (z *Zap) Warn(args ...interface{})

Warn logs with level Warn

func (*Zap) Warnf

func (z *Zap) Warnf(template string, args ...interface{})

Warnf formats and logs with level Warn

func (*Zap) Warningf

func (z *Zap) Warningf(template string, args ...interface{})

Warningf formats and logs with level Warn

func (Zap) WithFields

func (z Zap) WithFields(fields []Field, prefix string, suffix string) Logger

WithFields returns a clone of the logger which logs with prepended fields

Jump to

Keyboard shortcuts

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