logging

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DEBUG level
	DEBUG level = iota
	// INFO level
	INFO
	// WARNING level
	WARNING
	// ERROR level
	ERROR
	// FATAL level
	FATAL
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ColouredFormatter

type ColouredFormatter struct {
}

ColouredFormatter colours log messages with ASCI escape codes and adds filename and line number before the log message See https://en.wikipedia.org/wiki/ANSI_escape_code

func (*ColouredFormatter) Format

func (f *ColouredFormatter) Format(lvl level, v ...interface{}) []interface{}

Format adds filename and line number before the log message

func (*ColouredFormatter) GetPrefix

func (f *ColouredFormatter) GetPrefix(lvl level) string

GetPrefix returns colour escape code

func (*ColouredFormatter) GetSuffix

func (f *ColouredFormatter) GetSuffix(lvl level) string

GetSuffix returns reset sequence code

type DefaultFormatter

type DefaultFormatter struct {
}

DefaultFormatter adds filename and line number before the log message

func (*DefaultFormatter) Format

func (f *DefaultFormatter) Format(lvl level, v ...interface{}) []interface{}

Format adds filename and line number before the log message

func (*DefaultFormatter) GetPrefix

func (f *DefaultFormatter) GetPrefix(lvl level) string

GetPrefix returns ""

func (*DefaultFormatter) GetSuffix

func (f *DefaultFormatter) GetSuffix(lvl level) string

GetSuffix returns ""

type Formatter

type Formatter interface {
	GetPrefix(lvl level) string
	Format(lvl level, v ...interface{}) []interface{}
	GetSuffix(lvl level) string
}

Formatter interface

type Logger

type Logger map[level]LoggerInterface

Logger ...

func New

func New(out, errOut io.Writer, f Formatter) Logger

New returns instance of Logger

type LoggerInterface

type LoggerInterface interface {
	Print(...interface{})
	Printf(string, ...interface{})
	Println(...interface{})

	Fatal(...interface{})
	Fatalf(string, ...interface{})
	Fatalln(...interface{})

	Panic(...interface{})
	Panicf(string, ...interface{})
	Panicln(...interface{})
}

LoggerInterface logger interface

type Wrapper

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

Wrapper ...

func (*Wrapper) Fatal

func (w *Wrapper) Fatal(v ...interface{})

Fatal ...

func (*Wrapper) Fatalf

func (w *Wrapper) Fatalf(format string, v ...interface{})

Fatalf ...

func (*Wrapper) Fatalln

func (w *Wrapper) Fatalln(v ...interface{})

Fatalln ...

func (*Wrapper) Panic

func (w *Wrapper) Panic(v ...interface{})

Panic ...

func (*Wrapper) Panicf

func (w *Wrapper) Panicf(format string, v ...interface{})

Panicf ...

func (*Wrapper) Panicln

func (w *Wrapper) Panicln(v ...interface{})

Panicln ...

func (*Wrapper) Print

func (w *Wrapper) Print(v ...interface{})

Print ...

func (*Wrapper) Printf

func (w *Wrapper) Printf(format string, v ...interface{})

Printf ...

func (*Wrapper) Println

func (w *Wrapper) Println(v ...interface{})

Println ...

Jump to

Keyboard shortcuts

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