3 Star 3 Fork 1

Gitee 极速下载 / mymon

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/open-falcon/mymon
克隆/下载
logger.go 1.10 KB
一键复制 编辑 原始数据 按行查看 历史
/*
* Open-Falcon
*
* Copyright (c) 2014-2018 Xiaomi, Inc. All Rights Reserved.
*
* This product is licensed to you under the Apache License, Version 2.0 (the "License").
* You may not use this product except in compliance with the License.
*
* This product may include a number of subcomponents with separate copyright notices
* and license terms. Your use of these subcomponents is subject to the terms and
* conditions of the subcomponent's license, as noted in the LICENSE file.
*/
package common
import (
"fmt"
"github.com/astaxie/beego/logs"
)
// MyNewLogger constructor of needed logger
func MyNewLogger(conf *Config, logFile string) *logs.BeeLogger {
return loggerInit(conf, logFile)
}
func loggerInit(conf *Config, logFile string) (log *logs.BeeLogger) {
log = logs.NewLogger(0)
log.EnableFuncCallDepth(true)
log.SetLevel(conf.Base.LogLevel)
if conf.Base.LogDir == "console" {
_ = log.SetLogger("console")
} else {
_ = log.SetLogger(
"file", fmt.Sprintf(
`{"filename":"%s", "level":%d, "maxlines":0,
"maxsize":0, "daily":false, "maxdays":0}`,
logFile, conf.Base.LogLevel))
}
return
}
Shell
1
https://gitee.com/mirrors/mymon.git
git@gitee.com:mirrors/mymon.git
mirrors
mymon
mymon
fda4d97c10d2

搜索帮助