55 lines
1.1 KiB
Go
Raw Permalink Normal View History

2021-02-13 02:49:36 +00:00
package main
import (
"log"
"os"
)
var (
_logInfo *log.Logger
_logErr *log.Logger
_logWarn *log.Logger
_logConn *log.Logger
_logDebug *log.Logger
logFatal *log.Logger
)
func logInit() {
_logInfo = log.New(os.Stdout, "INFO: ", log.Lmsgprefix|log.Ldate|log.Ltime)
_logErr = log.New(os.Stdout, "ERR: ", log.Lmsgprefix|log.Ldate|log.Ltime)
_logWarn = log.New(os.Stdout, "WARN: ", log.Lmsgprefix|log.Ldate|log.Ltime)
_logConn = log.New(os.Stdout, "CONN: ", log.Lmsgprefix|log.Ldate|log.Ltime)
_logDebug = log.New(os.Stdout, "DEBUG: ", log.Lmsgprefix|log.Ldate|log.Ltime)
logFatal = log.New(os.Stdout, "FATAL: ", log.Lmsgprefix|log.Ldate|log.Ltime)
}
func logInfo(s ...interface{}) {
if (settings.LogLevel >= 1) {
_logInfo.Print(s...)
}
}
func logErr(s ...interface{}) {
if (settings.LogLevel >= 2) {
_logErr.Print(s...)
}
}
func logWarn(s ...interface{}) {
if (settings.LogLevel >= 3) {
_logWarn.Print(s...)
}
}
func logConn(s ...interface{}) {
if (settings.LogLevel >= 4) {
_logConn.Print(s...)
}
}
func logDebug(s ...interface{}) {
if (settings.LogLevel >= 5) {
_logConn.Print(s...)
}
}