logs

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: MIT Imports: 5 Imported by: 25

Documentation

Overview

Package logs 日志.

多级日志,文件滚动,不同级别日志可以分别使用不同文件。

Index

Constants

This section is empty.

Variables

View Source
var (
	T = log.New(_workers[Trace], "[T] ", _flag)
	D = log.New(_workers[Debug], "[D] ", _flag)
	I = log.New(_workers[Info], "[I] ", _flag)
	W = log.New(_workers[Warn], "[W] ", _flag)
	E = log.New(_workers[Error], "[E] ", _flag)
)

nolint: gochecknoglobals, varnamelen

Functions

func Close

func Close()

func LogFile

func LogFile(path, name string) (io.Writer, error)

func SetDebug

func SetDebug(writer io.Writer)

SetDebug 设置调试.

func SetDebugFile

func SetDebugFile(path, file string) error

SetDebugFile 设置调试输出.

func SetError

func SetError(writer io.Writer)

SetError 设置错误.

func SetErrorFile

func SetErrorFile(path, file string) error

SetErrorFile 设置错误文件输出.

func SetInfo

func SetInfo(writer io.Writer)

SetInfo 设置信息.

func SetInfoFile

func SetInfoFile(path, file string) error

SetInfoFile 设置文件输出.

func SetLevel

func SetLevel(level Level)

SetLevel 设置日志级别.

func SetLog

func SetLog(writer io.Writer)

SetLog 默认输出.

func SetLogFile

func SetLogFile(path, file string) error

SetLogFile 默认文件输出.

func SetTrace

func SetTrace(writer io.Writer)

SetTrace 设置跟踪.

func SetTraceFile

func SetTraceFile(path, file string) error

SetTraceFile 设置跟踪文件.

func SetWarn

func SetWarn(writer io.Writer)

SetWarn 设置警告.

func SetWarnFile

func SetWarnFile(path, file string) error

SetWarnFile 设置警告文件输出.

Types

type Level

type Level int

Level 日志级别.

const (
	Trace Level = iota
	Debug
	Info
	Warn
	Error
)

func GetLevel

func GetLevel() Level

GetLevel 获取日志级别.

Jump to

Keyboard shortcuts

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