stdlog

package
v0.0.0-...-dc66ec4 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Bits or'ed together to control what's printed. There is no control over the
	// order they appear (the order listed here) or the format they present (as
	// described in the comments).  A colon appears after these items:
	//	2009/0123 01:23:23.123123 /a/b/c/d.go:23: message
	Ldate         = 1 << iota     // the date: 2009/0123
	Ltime                         // the time: 01:23:23
	Lmicroseconds                 // microsecond resolution: 01:23:23.123123.  assumes Ltime.
	Llongfile                     // full file name and line number: /a/b/c/d.go:23
	Lshortfile                    // final file name element and line number: d.go:23. overrides Llongfile
	Lmodule                       // module name
	Llevel                        // level: 0(Debug), 1(Info), 2(Warn), 3(Error), 4(Panic), 5(Fatal)
	Llongcolor                    // color will start [info] end of line
	Lshortcolor                   // color only include [info]
	LstdFlags     = Ldate | Ltime // initial values for the standard logger

)

These flags define which text to prefix to each log entry generated by the Logger.

View Source
const (
	ForeBlack  = iota + 30 //30
	ForeRed                //31
	ForeGreen              //32
	ForeYellow             //33
	ForeBlue               //34
	ForePurple             //35
	ForeCyan               //36
	ForeWhite              //37
)
View Source
const (
	BackBlack  = iota + 40 //40
	BackRed                //41
	BackGreen              //42
	BackYellow             //43
	BackBlue               //44
	BackPurple             //45
	BackCyan               //46
	BackWhite              //47
)
View Source
const (
	Lall = iota
)

Variables

This section is empty.

Functions

func RmColorFlags

func RmColorFlags(flag int) int

func SetColors

func SetColors(cls []int)

MUST called before all logs

func Stack

func Stack(v ...interface{}) string

Types

type Logger

type Logger struct {
	Level int8
	// contains filtered or unexported fields
}

A Logger represents an active logging object that generates lines of output to an io.Writer. Each logging operation makes a single call to the Writer's Write method. A Logger can be used simultaneously from multiple goroutines; it guarantees to serialize access to the Writer.

func NewLogger

func NewLogger(out io.Writer, name string, level int8, callSkip int, m map[string]interface{}) (*Logger, error)

func (*Logger) Debug

func (l *Logger) Debug(ctx context.Context, msg string, fields ...zapcore.Field)

func (*Logger) Error

func (l *Logger) Error(ctx context.Context, msg string, err error, fields ...zapcore.Field)

func (*Logger) Fatal

func (l *Logger) Fatal(ctx context.Context, msg string, fields ...zapcore.Field)

func (*Logger) Flags

func (l *Logger) Flags() int

Flags r = append(r,s the output flags for the logger.

func (*Logger) GetLevel

func (l *Logger) GetLevel() int8

func (*Logger) Info

func (l *Logger) Info(ctx context.Context, msg string, fields ...zapcore.Field)

func (*Logger) Location

func (l *Logger) Location() *time.Location

func (*Logger) Panic

func (l *Logger) Panic(ctx context.Context, msg string, fields ...zapcore.Field)

func (*Logger) Prefix

func (l *Logger) Prefix() string

Prefix r = append(r,s the output prefix for the logger.

func (*Logger) SetFlags

func (l *Logger) SetFlags(flag int)

SetFlags sets the output flags for the logger.

func (*Logger) SetLevel

func (l *Logger) SetLevel(level int8)

func (*Logger) SetLocation

func (l *Logger) SetLocation(loc *time.Location)

func (*Logger) SetPrefix

func (l *Logger) SetPrefix(prefix string)

SetPrefix sets the output prefix for the logger.

func (*Logger) Stat

func (l *Logger) Stat() (stats []int64)

-----------------------------------------

func (*Logger) Warn

func (l *Logger) Warn(ctx context.Context, msg string, fields ...zapcore.Field)

Jump to

Keyboard shortcuts

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