log

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2018 License: GPL-3.0 Imports: 2 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() *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) 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)
	Write(p []byte) (int, error)
}

Logger defines the logging interface.

Jump to

Keyboard shortcuts

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