service: logging to syslog (#33)
* service: logging to syslog * chore: update gopsutil to v4 * chore: move println() to the util package * gpu: only return 0 on failure
This commit is contained in:
+17
-1
@@ -1,13 +1,29 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
"github.com/nezhahq/service"
|
||||
)
|
||||
|
||||
var Json = jsoniter.ConfigCompatibleWithStandardLibrary
|
||||
var (
|
||||
Json = jsoniter.ConfigCompatibleWithStandardLibrary
|
||||
Logger service.Logger
|
||||
)
|
||||
|
||||
func IsWindows() bool {
|
||||
return os.PathSeparator == '\\' && os.PathListSeparator == ';'
|
||||
}
|
||||
|
||||
func Println(v ...interface{}) {
|
||||
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...)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user