gologger

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

README

#1 定义log级别 DEBUG INFO WARNING ERROR FATAL

#需求 ###1、支持多个不同位置输出日志 ###2、日志级别 ###3、通过ini配置文件 ###4、完整的日志包含时间,行号,文件名,日志级别,日志信息 ###5、日志切割

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsoleLogger

type ConsoleLogger struct {
	Level LogLevel
}
var Log *ConsoleLogger

func NewConsoleLogger

func NewConsoleLogger(levelStr string) *ConsoleLogger

构造函数

func (*ConsoleLogger) DEBUG

func (l *ConsoleLogger) DEBUG(fotmat string, a ...interface{})

func (*ConsoleLogger) ERROR

func (l *ConsoleLogger) ERROR(fotmat string, a ...interface{})

func (*ConsoleLogger) FATAL

func (l *ConsoleLogger) FATAL(fotmat string, a ...interface{})

func (*ConsoleLogger) INFO

func (l *ConsoleLogger) INFO(fotmat string, a ...interface{})

func (*ConsoleLogger) WARNING

func (l *ConsoleLogger) WARNING(fotmat string, a ...interface{})

type FileLogger

type FileLogger struct {
	Level LogLevel

	MaxSize int64
	// contains filtered or unexported fields
}

func NewFileLogger

func NewFileLogger(levelStr, fp, fn string, maxSize int64) *FileLogger

func (*FileLogger) DEBUG

func (l *FileLogger) DEBUG(fotmat string, a ...interface{})

func (*FileLogger) ERROR

func (l *FileLogger) ERROR(fotmat string, a ...interface{})

func (*FileLogger) FATAL

func (l *FileLogger) FATAL(fotmat string, a ...interface{})

func (*FileLogger) INFO

func (l *FileLogger) INFO(fotmat string, a ...interface{})

func (*FileLogger) WARNING

func (l *FileLogger) WARNING(fotmat string, a ...interface{})

type LogLevel

type LogLevel uint
const (
	UNKNOWN LogLevel = iota
	DEBUG
	INFO
	WARNING
	ERROR
	FATAL
)

type LogOutPut

type LogOutPut interface {
	INFO(fotmat string, a ...interface{})
	WARNING(fotmat string, a ...interface{})
	ERROR(fotmat string, a ...interface{})
	FATAL(fotmat string, a ...interface{})
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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