Documentation ¶
Index ¶
- Constants
- Variables
- func CallerInfo(skip int) (string, string, int)
- func NewFDailyLogger(path string, prefix string, flag int) (*log.Logger, io.Closer, error)
- func NewFHourlyLogger(path string, prefix string, flag int) (*log.Logger, io.Closer, error)
- func NewSFDailyLogger(path string, level slog.Level) (*slog.Logger, io.Closer, error)
- func NewSFHourlyLogger(path string, level slog.Level) (*slog.Logger, io.Closer, error)
- func Shortpath(p string, n uint) string
- func SimpleFLogger(path string, prefix string, flag int) (*log.Logger, *os.File, error)
- func SimpleLogger(path string, prefix string) (*log.Logger, *os.File, error)
- func Std(prefix string) *log.Logger
- type TimedRotatingFile
Constants ¶
View Source
const ( // WhenMinutely 分钟级 WhenMinutely = 1 // WhenHourly 小时级 WhenHourly = 2 // WhenDaily 天级 WhenDaily = 3 )
Variables ¶
View Source
var ( // LogFileNameDailyFormat 天级文件名模式 LogFileNameDailyFormat = "2006-01-02" // LogFileNameHourlyFormat 小时级文件名模式 LogFileNameHourlyFormat = "2006-01-02T15" // LogFileNameMinutelyFormat 分钟级文件名模式 LogFileNameMinutelyFormat = "2006-01-02T15:04" )
View Source
var (
// LogCallDepth 打印调用深度
LogCallDepth = 2
)
Functions ¶
func NewFDailyLogger ¶
NewFDailyLogger 天切片日志
func NewFHourlyLogger ¶
NewFHourlyLogger 小时切片日志
func NewSFDailyLogger ¶
NewSFDailyLogger 天切片结构化日志
func NewSFHourlyLogger ¶
NewSFHourlyLogger 小时切片结构化日志
func SimpleFLogger ¶
SimpleFLogger ...
func SimpleLogger ¶
SimpleLogger 便捷方法
Types ¶
type TimedRotatingFile ¶
type TimedRotatingFile struct {
// contains filtered or unexported fields
}
TimedRotatingFile implement io.Writer
时间切分文件, 不能多进程使用 log.Logger模块在Output()时本身会加锁,因此这里没有额外加锁
func NewDailyRotatingFile ¶
func NewDailyRotatingFile(path string) (*TimedRotatingFile, error)
NewDailyRotatingFile 创建按天切分的文件
func NewHourlyRotatingFile ¶
func NewHourlyRotatingFile(path string) (*TimedRotatingFile, error)
NewHourlyRotatingFile 创建按小时切分的文件
func NewTimedRotatingFile ¶
func NewTimedRotatingFile(path string, when int, format string) (*TimedRotatingFile, error)
NewTimedRotatingFile 创建时间切分的文件
Click to show internal directories.
Click to hide internal directories.