1 Star 0 Fork 0

王耀辉 / utils

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
log.go 992 Bytes
一键复制 编辑 原始数据 按行查看 历史
王耀辉 提交于 2022-07-17 00:14 . job prototype
// Copyright (c) 2022 Yaohui Wang (yaohuiwang@outlook.com)
// utils is licensed under Mulan PubL v2.
// You can use this software according to the terms and conditions of the Mulan PubL v2.
// You may obtain a copy of Mulan PubL v2 at:
// http://license.coscl.org.cn/MulanPubL-2.0
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
// MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
// See the Mulan PubL v2 for more details.
package utils
import (
"fmt"
"log"
)
const (
LOG_DEBUG int = iota
LOG_INFO
LOG_WARN
LOG_ERROR
)
var (
Logger *log.Logger = log.Default()
LogLevel int = LOG_DEBUG
LogLabel []string = []string{"DEBUG", "INFO", "WARN", "ERROR"}
)
func LogPrintf(level int, module string, format string, v ...interface{}) {
if level < LogLevel {
return
}
Logger.Printf("[%s] %s: %s", LogLabel[level], module, fmt.Sprintf(format, v...))
}
Go
1
https://gitee.com/yaohuiwang/utils.git
git@gitee.com:yaohuiwang/utils.git
yaohuiwang
utils
utils
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891