log

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEBUG = Level(iota)
	INFO
	WARN
	FATAL
	PANIC
)

Variables

View Source
var LevelStr = map[Level]string{
	DEBUG: "debug",
	INFO:  "info",
	WARN:  "warn",
	FATAL: "fatal",
	PANIC: "panic",
}

Functions

This section is empty.

Types

type Config

type Config struct {
	InfoOutFile  string
	ErrorOutFile string
	Level        Level
	// 不显示时间
	NotShowTime bool
	// 时间格式,默认:YYYY-MM-DD hh:mm:ss
	TimeLayout string

	// 不显示颜色,默认:false
	NotShowColor bool
	// Debug 颜色,默认:FgBlue
	DebugColor color.Colors
	// Info 颜色,默认:无
	InfoColor color.Colors
	// Warn 颜色,默认:FgYellow
	WarnColor color.Colors
	// Fatal 颜色,默认:FgRed
	FatalColor color.Colors
	// Panic 颜色,默认:FgHiRed
	PanicColor color.Colors
}

func (*Config) Apply

func (c *Config) Apply(config *Config)

Apply 更新配置

type Level

type Level int

type Log

type Log struct {
	*Config
}

func NewLog

func NewLog(option ...Option) *Log

func (Log) Debug

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

func (Log) Fatal

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

func (Log) Info

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

func (Log) Panic

func (l Log) Panic(format string, a ...interface{})

func (Log) Warn

func (l Log) Warn(format string, a ...interface{})

type Option

type Option interface {
	Apply(config *Config)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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