log

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2018 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Blue

func Blue(content interface{}) string

Blue return content with blue color

func Bold

func Bold(content interface{}) string

Bold return content with bold text

func Green

func Green(content interface{}) string

Green return content with green color

func Magenta

func Magenta(content interface{}) string

Magenta return content with magenta color

func Red

func Red(content interface{}) string

Red return content with red color

func Reverse

func Reverse(content interface{}) string

Reverse return content with reverse colors

func Yellow

func Yellow(content interface{}) string

Yellow return content with yellow color

Types

type ConsoleLogger

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

ConsoleLogger output messages to console

func NewConsoleLogger

func NewConsoleLogger(tag string) *ConsoleLogger

NewConsoleLogger creates a new ConsoleLogger

func (*ConsoleLogger) Debugf

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

Debugf logs a DEBUG message

func (*ConsoleLogger) Error

func (l *ConsoleLogger) Error(err error)

Error logs a ERROR message

func (*ConsoleLogger) Errorf

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

Errorf logs a ERROR message

func (*ConsoleLogger) Infof

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

Infof logs a INFO message

func (*ConsoleLogger) IsEnabled added in v0.10.0

func (l *ConsoleLogger) IsEnabled(level Level) bool

IsEnabled returns true if given level is enabled

func (*ConsoleLogger) SetLevel

func (l *ConsoleLogger) SetLevel(level Level)

SetLevel increases/decreases current log level

func (*ConsoleLogger) Warnf

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

Warnf logs a WARN message

func (*ConsoleLogger) Write added in v0.9.0

func (l *ConsoleLogger) Write(p []byte) (int, error)

Write writes len(p) bytes from p to the underlying data stream.

type Level

type Level uint8

Level defines all possible log levels

const (
	// DEBUG for verbose logs
	DEBUG Level = iota + 1
	// INFO for WARN+ERROR+INFO logs
	INFO
	// WARN for WARN+ERROR logs
	WARN
	// ERROR for ERROR only logs
	ERROR
)

type Logger

type Logger interface {
	SetLevel(level Level)
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Error(err error)
	IsEnabled(level Level) bool
	Write(p []byte) (int, error)
}

Logger defines the logging interface.

type NoopLogger added in v0.10.0

type NoopLogger struct {
}

NoopLogger doesn't log anything

func NewNoopLogger added in v0.10.0

func NewNoopLogger() *NoopLogger

NewNoopLogger creates a new NoopLogger

func (*NoopLogger) Debugf added in v0.10.0

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

Debugf logs a DEBUG message

func (*NoopLogger) Error added in v0.10.0

func (l *NoopLogger) Error(err error)

Error logs a ERROR message

func (*NoopLogger) Errorf added in v0.10.0

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

Errorf logs a ERROR message

func (*NoopLogger) Infof added in v0.10.0

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

Infof logs a INFO message

func (*NoopLogger) IsEnabled added in v0.10.0

func (l *NoopLogger) IsEnabled(level Level) bool

IsEnabled returns true if given level is enabled

func (*NoopLogger) SetLevel added in v0.10.0

func (l *NoopLogger) SetLevel(level Level)

SetLevel increases/decreases current log level

func (*NoopLogger) Warnf added in v0.10.0

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

Warnf logs a WARN message

func (*NoopLogger) Write added in v0.10.0

func (l *NoopLogger) Write(p []byte) (int, error)

Write writes len(p) bytes from p to the underlying data stream.

Jump to

Keyboard shortcuts

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