logs

package module
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

README

logs

log日志

Documentation

Index

Constants

View Source
const (
	OutputBash = outputBash
	OutputFile = outputFile
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LogLevel

type LogLevel int8
const (
	DebugLevel LogLevel = iota - 1
	InfoLevel
	ErrorLevel
	DPanicLevel
)

日志等级

type LogOutputTarget

type LogOutputTarget int8

type Logger

type Logger interface {
	Debug(msg ...any)
	Debugf(msg string, args ...any)
	StackDebug(msg ...any)
	StackDebugf(msg string, args ...any)
	Info(msg ...any)
	Infof(msg string, args ...any)
	StackInfo(msg ...any)
	StackInfof(msg string, args ...any)
	Error(msg ...any)
	Errorf(msg string, args ...any)
	StackError(msg ...any)
	StackErrorf(msg string, args ...any)
	DPanic(msg ...any)
	DPanicf(msg string, args ...any)
	StackDPanic(msg ...any)
	StackDPanicf(msg string, args ...any)
}

Logger 日志接口

func NewLogger

func NewLogger(level LogLevel, opt ...Options) (Logger, error)

NewLogger 输出到文件中默认按天进行分割日志

type Options

type Options func(*logger)

func LogOutputToBash

func LogOutputToBash() Options

LogOutputToBash 日志输出到终端

func LogOutputToFile

func LogOutputToFile(dir string) Options

LogOutputToFile 日志输出到文件

Jump to

Keyboard shortcuts

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