feat: add option to disable syslog logging (#53)

* feat: add option to disable syslog logging

* missing comments

* service flags

* initialize util.Logger
This commit is contained in:
UUBulb
2024-08-09 22:03:41 +08:00
committed by GitHub
parent 1f7706201b
commit ac1a34e33e
3 changed files with 17 additions and 17 deletions
+3 -9
View File
@@ -3,7 +3,6 @@ package util
import (
"fmt"
"os"
"runtime"
"time"
jsoniter "github.com/json-iterator/go"
@@ -11,8 +10,8 @@ import (
)
var (
Json = jsoniter.ConfigCompatibleWithStandardLibrary
Logger service.Logger
Json = jsoniter.ConfigCompatibleWithStandardLibrary
Logger service.Logger = service.ConsoleLogger
)
func IsWindows() bool {
@@ -21,11 +20,6 @@ func IsWindows() bool {
func Println(enabled bool, v ...interface{}) {
if enabled {
if runtime.GOOS != "darwin" {
Logger.Infof("NEZHA@%s>> %v", time.Now().Format("2006-01-02 15:04:05"), fmt.Sprint(v...))
} else {
fmt.Printf("NEZHA@%s>> ", time.Now().Format("2006-01-02 15:04:05"))
fmt.Println(v...)
}
Logger.Infof("NEZHA@%s>> %v", time.Now().Format("2006-01-02 15:04:05"), fmt.Sprint(v...))
}
}