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:
+3
-9
@@ -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...))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user