mappers

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2018 License: MIT Imports: 4 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdvancedMap

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

AdvancedMap maps a standard logger to an advanced logger interface.

func NewAdvancedMap

func NewAdvancedMap(m LevelMapper) *AdvancedMap

NewAdvancedMap returns an advanced logger that is mapped via mapper.

func NewAdvancedMapTesting

func NewAdvancedMapTesting(m LevelMapper, t TestHelper) *AdvancedMap

NewAdvancedMapTesting returns an advanced logger that is mapped via mapper. A TestHelper can be passed that will then be invoked (when not nil) on each log statement marking that function call as a test helper call and causing file/line information to be skipped.

func (*AdvancedMap) Debug

func (a *AdvancedMap) Debug(v ...interface{})

Debug should be used when logging exessive debug info.

func (*AdvancedMap) Debugf

func (a *AdvancedMap) Debugf(format string, v ...interface{})

Debugf works the same as Debug but supports formatting.

func (*AdvancedMap) Debugln

func (a *AdvancedMap) Debugln(v ...interface{})

Debugln works the same as Debug but supports formatting.

func (*AdvancedMap) Error

func (a *AdvancedMap) Error(v ...interface{})

Error should be used only if real error occures.

func (*AdvancedMap) Errorf

func (a *AdvancedMap) Errorf(format string, v ...interface{})

Errorf works the same as Error but supports formatting.

func (*AdvancedMap) Errorln

func (a *AdvancedMap) Errorln(v ...interface{})

Errorln works the same as Error but supports formatting.

func (*AdvancedMap) Fatal

func (s *AdvancedMap) Fatal(v ...interface{})

Fatal works the same as Error but it terminates the program right after logging. Fatal should be only used when it's not possible to continue program execution.

func (*AdvancedMap) Fatalf

func (s *AdvancedMap) Fatalf(format string, v ...interface{})

Fatalf works the same as Fatal but supports formatting.

func (*AdvancedMap) Fatalln

func (s *AdvancedMap) Fatalln(v ...interface{})

Fatalln works the same as Info but supports formatting.

func (*AdvancedMap) Info

func (a *AdvancedMap) Info(v ...interface{})

Info is a general function to log something.

func (*AdvancedMap) Infof

func (a *AdvancedMap) Infof(format string, v ...interface{})

Infof works the same as Info but supports formatting.

func (*AdvancedMap) Infoln

func (a *AdvancedMap) Infoln(v ...interface{})

Infoln works the same as Info but supports formatting.

func (*AdvancedMap) Panic

func (s *AdvancedMap) Panic(v ...interface{})

Panic works the same as Error but it terminates the program right after logging.

func (*AdvancedMap) Panicf

func (s *AdvancedMap) Panicf(format string, v ...interface{})

Panicf works the same as Panic but supports formatting.

func (*AdvancedMap) Panicln

func (s *AdvancedMap) Panicln(v ...interface{})

Panicln works the same as Panic but supports formatting.

func (*AdvancedMap) Print

func (s *AdvancedMap) Print(v ...interface{})

Print should be used only if real error occures.

func (*AdvancedMap) Printf

func (s *AdvancedMap) Printf(format string, v ...interface{})

Printf works the same as Print but supports formatting.

func (*AdvancedMap) Println

func (s *AdvancedMap) Println(v ...interface{})

Println works the same as Print but supports formatting.

func (*AdvancedMap) Warn

func (a *AdvancedMap) Warn(v ...interface{})

Warn is useful for alerting about something wrong.

func (*AdvancedMap) Warnf

func (a *AdvancedMap) Warnf(format string, v ...interface{})

Warnf works the same as Warn but supports formatting.

func (*AdvancedMap) Warnln

func (a *AdvancedMap) Warnln(v ...interface{})

Warnln works the same as Warn but supports formatting.

type ContextualMap

type ContextualMap struct {
	AdvancedMap
	ContextualMapper
}

ContextualMap maps a logger to a contextual logger interface.

func NewContextualMap

func NewContextualMap(m ContextualMapper) *ContextualMap

NewContextualMap returns an contextual logger that is mapped via mapper.

func NewContextualMapTesting

func NewContextualMapTesting(m ContextualMapper, t TestHelper) *ContextualMap

NewContextualMapTesting returns an contextual logger that is mapped via mapper. A TestHelper can be passed that will then be invoked (when not nil) on each log statement marking that function call as a test helper call and causing file/line information to be skipped.

func (*ContextualMap) Fatal

func (s *ContextualMap) Fatal(v ...interface{})

Fatal works the same as Error but it terminates the program right after logging. Fatal should be only used when it's not possible to continue program execution.

func (*ContextualMap) Fatalf

func (s *ContextualMap) Fatalf(format string, v ...interface{})

Fatalf works the same as Fatal but supports formatting.

func (*ContextualMap) Fatalln

func (s *ContextualMap) Fatalln(v ...interface{})

Fatalln works the same as Info but supports formatting.

func (*ContextualMap) Panic

func (s *ContextualMap) Panic(v ...interface{})

Panic works the same as Error but it terminates the program right after logging.

func (*ContextualMap) Panicf

func (s *ContextualMap) Panicf(format string, v ...interface{})

Panicf works the same as Panic but supports formatting.

func (*ContextualMap) Panicln

func (s *ContextualMap) Panicln(v ...interface{})

Panicln works the same as Panic but supports formatting.

func (*ContextualMap) Print

func (s *ContextualMap) Print(v ...interface{})

Print should be used only if real error occures.

func (*ContextualMap) Printf

func (s *ContextualMap) Printf(format string, v ...interface{})

Printf works the same as Print but supports formatting.

func (*ContextualMap) Println

func (s *ContextualMap) Println(v ...interface{})

Println works the same as Print but supports formatting.

func (*ContextualMap) WithField

func (c *ContextualMap) WithField(key string, value interface{}) loggers.Advanced

WithField directly maps the loggers method.

func (*ContextualMap) WithFields

func (c *ContextualMap) WithFields(fields ...interface{}) loggers.Advanced

WithFields directly maps the loggers method.

type ContextualMapper

type ContextualMapper interface {
	LevelMapper
	WithField(key string, value interface{}) loggers.Advanced
	WithFields(fields ...interface{}) loggers.Advanced
}

ContextualMapper interfaces allows a logger to map to any Contextual Logger.

type Level

type Level byte

Level indicates a specific log level.

const (
	// LevelDebug is a log Level.
	LevelDebug Level = iota
	// LevelInfo is a log Level.
	LevelInfo
	// LevelWarn is a log Level.
	LevelWarn
	// LevelError is a log Level.
	LevelError
	// LevelFatal is a log Level.
	LevelFatal
	// LevelPanic is a log Level.
	LevelPanic
)

func (Level) String

func (l Level) String() string

type LevelMapper

type LevelMapper interface {
	LevelPrint(Level, ...interface{})
	LevelPrintf(Level, string, ...interface{})
	LevelPrintln(Level, ...interface{})
}

LevelMapper interfaces allows a logger to map to any Advanced Logger.

type TestHelper

type TestHelper interface {
	Helper()
}

TestHelper describes a *testing.T helper. See: https://golang.org/pkg/testing/#T.Helper

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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