1 Star 0 Fork 0

linxing / youye-core

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
options.go 951 Bytes
一键复制 编辑 原始数据 按行查看 历史
Mark 提交于 2024-04-16 11:22 . feat:修改logger初始化方式
/*
* @Author: lwnmengjing
* @Date: 2021/6/10 10:26 上午
* @Last Modified by: lwnmengjing
* @Last Modified time: 2021/6/10 10:26 上午
*/
package logger
type Option func(*options)
type options struct {
driver string
path string
level string
stdout string
cap uint
callSkip int
}
func setDefault() options {
return options{
driver: "default",
path: "temp/logs",
level: "warn",
stdout: "default",
callSkip: 2,
}
}
func WithType(s string) Option {
return func(o *options) {
o.driver = s
}
}
func WithPath(s string) Option {
return func(o *options) {
o.path = s
}
}
func WithLevel(s string) Option {
return func(o *options) {
o.level = s
}
}
func WithStdout(s string) Option {
return func(o *options) {
o.stdout = s
}
}
func WithCap(n uint) Option {
return func(o *options) {
o.cap = n
}
}
func WithCallSkip(n int) Option {
return func(o *options) {
o.callSkip = n
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/linxing_3/youye-core.git
git@gitee.com:linxing_3/youye-core.git
linxing_3
youye-core
youye-core
v0.0.1-202405061706

搜索帮助

344bd9b3 5694891 D2dac590 5694891