mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
add log path for save it
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
|||||||
type args struct {
|
type args struct {
|
||||||
Port string `arg:"-p" help:"web server port"`
|
Port string `arg:"-p" help:"web server port"`
|
||||||
Path string `arg:"-d" help:"database path"`
|
Path string `arg:"-d" help:"database path"`
|
||||||
|
LogPath string `arg:"-l" help:"log path"`
|
||||||
RDB bool `arg:"-r" help:"start in read-only DB mode"`
|
RDB bool `arg:"-r" help:"start in read-only DB mode"`
|
||||||
DontKill bool `arg:"-k" help:"dont kill program on signal"`
|
DontKill bool `arg:"-k" help:"dont kill program on signal"`
|
||||||
}
|
}
|
||||||
@@ -39,6 +40,8 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
settings.Path = params.Path
|
settings.Path = params.Path
|
||||||
|
log.Init(params.LogPath)
|
||||||
|
|
||||||
dnsResolve()
|
dnsResolve()
|
||||||
Preconfig(params.DontKill)
|
Preconfig(params.DontKill)
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,22 @@ package log
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func Init(path string) {
|
||||||
|
if path != "" {
|
||||||
|
ff, err := os.Create(path)
|
||||||
|
if err != nil {
|
||||||
|
TLogln("Error create log file:", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
os.Stdout = ff
|
||||||
|
os.Stderr = ff
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TLogln(v ...interface{}) {
|
func TLogln(v ...interface{}) {
|
||||||
log.Println(v...)
|
log.Println(v...)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user