log

package
v0.0.0-...-0871eb3 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: MIT Imports: 8 Imported by: 8

Documentation

Index

Constants

View Source
const (
	// DebugPrefix is of debug prefix
	DebugPrefix string = "[DEBUG]"
	// InfoPrefix is of info prefix
	InfoPrefix string = "[INFO]"
	// WarningPrefix is of warning prefix
	WarningPrefix string = "[WARNING]"
	// ErrorPrefix is of error prefix
	ErrorPrefix string = "[ERROR]"
	// FatalPrefix is of fatal prefix
	FatalPrefix string = "[FATAL]"
	// StackPrefix is of fatal prefix
	StackPrefix string = "[STACK]"
)

Variables

This section is empty.

Functions

func Debug

func Debug(v ...interface{})

Debug is to call output func for debug log

func Debugf

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

Debugf is to call output func for debug log with format

func Error

func Error(v ...interface{})

Error is to call output func for error log

func Errorf

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

Errorf is to call output func for error log with format

func Fatal

func Fatal(v ...interface{})

Fatal is to call output func for fatal log

func Fatalf

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

Fatalf is to call output func for fatal log with format

func Info

func Info(v ...interface{})

Info is to call output func for info log

func Infof

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

Infof is to call output func for info log with format

func InitializeLog

func InitializeLog(level LogStatus, logFmt LogFmt, prefix, fileName, delimiter string)

InitializeLog is to initialize base log object using default setting

func Stack

func Stack()

Stack is to call output func for stack trace

func Warn

func Warn(v ...interface{})

Warn is to call output func for warn log

func Warnf

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

Warnf is to call output func for warn log with format

Types

type LogFmt

type LogFmt int

LogFmt is log format

const (
	// NoDateNoFile is no date no file
	NoDateNoFile LogFmt = 0
	// OnlyTime is only time
	OnlyTime LogFmt = log.Ltime
	// TimeShortFile is time with short file name
	TimeShortFile LogFmt = log.Ltime | log.Lshortfile //should be default
	// DateTimeShortFile is date time with short file name
	DateTimeShortFile LogFmt = log.LstdFlags | log.Lshortfile
)

func (LogFmt) Int

func (lf LogFmt) Int() int

Int is to convert to type int

type LogStatus

type LogStatus uint8

LogStatus is logStatus

const (
	// DebugStatus is at debug level
	DebugStatus LogStatus = iota + 1
	// InfoStatus is at info level
	InfoStatus
	// WarningStatus is at warning level
	WarningStatus
	// ErrorStatus is at error level
	ErrorStatus
	// FatalStatus is at fatal level
	FatalStatus
	// StackStatus is at stack level
	StackStatus
	// LogOff is at no log
	LogOff
)

type LogType

type LogType uint8

LogType is console or file to output

const (
	// File is output as file
	File LogType = iota + 1
	// Console is output as console
	Console
)

type Logger

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

Logger is for log object

func New

func New(level LogStatus, logFmt LogFmt, prefix, fileName, delimiter string) *Logger

New is to create new log object

func (*Logger) Debug

func (lo *Logger) Debug(v ...interface{})

Debug is to call output func for debug log

func (*Logger) Debugf

func (lo *Logger) Debugf(format string, v ...interface{})

Debugf is to call output func for debug log with format

func (*Logger) Error

func (lo *Logger) Error(v ...interface{})

Error is to call output func for error log

func (*Logger) Errorf

func (lo *Logger) Errorf(format string, v ...interface{})

Errorf is to call output func for error log with format

func (*Logger) Fatal

func (lo *Logger) Fatal(v ...interface{})

Fatal is to call output func for fatal log

func (*Logger) Fatalf

func (lo *Logger) Fatalf(format string, v ...interface{})

Fatalf is to call output func for fatal log with format

func (*Logger) Info

func (lo *Logger) Info(v ...interface{})

Info is to call output func for info log

func (*Logger) Infof

func (lo *Logger) Infof(format string, v ...interface{})

Infof is to call output func for info log with format

func (*Logger) Out

func (lo *Logger) Out(key string, v ...interface{})

Out is to output log

func (*Logger) Outf

func (lo *Logger) Outf(key, format string, v ...interface{})

Outf is to output log with format

func (*Logger) Stack

func (lo *Logger) Stack()

Stack is to call output func for stack trace

func (*Logger) Warn

func (lo *Logger) Warn(v ...interface{})

Warn is to call output func for warn log

func (*Logger) Warnf

func (lo *Logger) Warnf(format string, v ...interface{})

Warnf is to call output func for warn log with format

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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