golang日志库
Go to file
Akvicor 4e03b69425
Security / scan (1.19.13) (push) Successful in 1m0s Details
Security / scan (>=1.20) (push) Successful in 51s Details
Test / uint (1.19.13, ubuntu-latest) (push) Successful in 1m17s Details
Test / uint (>=1.20, ubuntu-latest) (push) Successful in 49s Details
Verify / lint (1.19.13) (push) Successful in 1m9s Details
Verify / lint (>=1.20) (push) Successful in 1m4s Details
v0.1.5
2024-01-24 00:30:04 +08:00
.gitea/workflows actions 2024-01-24 00:15:07 +08:00
.gitignore flag 2024-01-21 21:14:35 +08:00
LICENSE Initial commit 2023-01-20 10:19:06 +08:00
README.md actions 2024-01-24 00:07:00 +08:00
file.go v0.1.5 2024-01-24 00:30:04 +08:00
glog.go v0.1.5 2024-01-24 00:30:04 +08:00
go.mod v0.1.3 2023-02-24 23:45:03 +08:00

README.md

glog

自用的golang日志库

GoReport Gitea Release License: GPL v2 Go.Dev reference

import "git.viry.cc/gomod/glog"

类型

使用SetMask(m int)设置每种消息是否输出

  • Unknown(format string, values ...any): 写入os.Stdout
  • Debug(format string, values ...any): 写入os.Stdout
  • Trace(format string, values ...any): 写入os.Stdout
  • Info(format string, values ...any): 写入os.Stdout
  • Warning(format string, values ...any): 写入os.Stdout
  • Error(format string, values ...any): 写入os.Stderr
  • Fatal(format string, values ...any): 写入os.Stderr

前缀

支持添加时间、类型、调用位置,使用SetFlag(f int)设置前缀。

文件

支持在显示在控制台的同时写入文件,通过SetLogFile(path string) error设置文件,设置后会自动写入此文件。

通过CloseFile()关闭文件,关闭后不再写入文件