mylogger

package
v0.0.0-...-cda2c63 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileLog

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

func NewFileLog

func NewFileLog(levelstr, fp, fn string, maxSize int64) *FileLog

func (*FileLog) Close

func (f *FileLog) Close()

关闭日志文件

func (*FileLog) Debug

func (f *FileLog) Debug(format string, a ...interface{})

func (*FileLog) Error

func (f *FileLog) Error(format string, a ...interface{})

func (*FileLog) Fatal

func (f *FileLog) Fatal(format string, a ...interface{})

func (*FileLog) Info

func (f *FileLog) Info(format string, a ...interface{})

func (*FileLog) Trace

func (f *FileLog) Trace(format string, a ...interface{})

func (*FileLog) Warning

func (f *FileLog) Warning(format string, a ...interface{})

func (*FileLog) WriteLogbg

func (f *FileLog) WriteLogbg()

后台写日志

type Logger

type Logger struct {
	Level Loglevel
}

func Newconsolelog

func Newconsolelog(levelstr string) Logger

func (Logger) Debug

func (l Logger) Debug(format string, a ...interface{})

func (Logger) Error

func (l Logger) Error(format string, a ...interface{})

func (Logger) Fatal

func (l Logger) Fatal(format string, a ...interface{})

func (Logger) Info

func (l Logger) Info(format string, a ...interface{})

func (Logger) Trace

func (l Logger) Trace(format string, a ...interface{})

func (Logger) Warning

func (l Logger) Warning(format string, a ...interface{})

type LoggerIO

type LoggerIO interface {
	Debug(format string, a ...interface{})
	Trace(format string, a ...interface{})
	Info(format string, a ...interface{})
	Warning(format string, a ...interface{})
	Error(format string, a ...interface{})
	Fatal(format string, a ...interface{})
}

接口

type Loglevel

type Loglevel uint16

支持不同地方的输出 日志级别 debug trace info warning error fatal 支持开关控制 包含时间,行号,文件名,日志级别,日志信息 日志文件切割

const (
	UNKNOW Loglevel = iota
	DEBUG
	TRACE
	INFO
	WARNING
	ERROR
	FATAL
)

func ParseLogLevel

func ParseLogLevel(s string) (Loglevel, error)

Jump to

Keyboard shortcuts

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