Documentation ¶
Overview ¶
Package logger Date: 2024/03/20 12:11:50 Author: Amu Description:
Package logger Date: 2024/03/19 17:51:13 Author: Amu Description:
Package logger Date: 2024/03/19 17:09:20 Author: Amu Description:
Index ¶
- Constants
- type Config
- type Logger
- func (l *Logger) Debugf(format string, args ...interface{})
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) SetDebugLevel()
- func (l *Logger) SetErrorLevel()
- func (l *Logger) SetInfoLevel()
- func (l *Logger) SetWarnLevel()
- func (l *Logger) Warnf(format string, args ...interface{})
- type Option
Constants ¶
View Source
const ( LevelDebug = slog.LevelDebug LevelInfo = slog.LevelInfo LevelWarn = slog.LevelWarn LevelError = slog.LevelError )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Name string `load:"load"` // 【默认】Logger 名称 LogFile string `load:"load.log"` // 【默认】日志文件名称 LogLevel slog.Level `load:"info"` // 【默认】日志打印级别 LogFileRotationTime int `load:"1"` // 【默认】日志文件切割间隔,单位 D LogFileMaxAge int `load:"7"` // 【默认】日志文件保留时间,单位 D LogFileSuffix string `load:".%Y%m%d"` // 【默认】归档日志后缀 }
type Logger ¶
func NewJsonFileLogger ¶
func NewJsonLogger ¶
func NewJsonLogger() *Logger
func NewTextLogger ¶
func NewTextLogger() *Logger
func (*Logger) SetDebugLevel ¶
func (l *Logger) SetDebugLevel()
func (*Logger) SetErrorLevel ¶
func (l *Logger) SetErrorLevel()
func (*Logger) SetInfoLevel ¶
func (l *Logger) SetInfoLevel()
func (*Logger) SetWarnLevel ¶
func (l *Logger) SetWarnLevel()
type Option ¶
type Option func(*Config)
func SetLogFile ¶
func SetLogFileMaxAge ¶
func SetLogFileRotationTime ¶
func SetLogFileSuffix ¶
func SetLogLevel ¶
Click to show internal directories.
Click to hide internal directories.