mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 12:42:34 +02:00
fixed outputing error in ls-config, ls-routes, etc.
This commit is contained in:
parent
69361aea1b
commit
6388d9d44d
1 changed files with 15 additions and 10 deletions
25
src/main.go
25
src/main.go
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
@ -35,13 +36,17 @@ func main() {
|
||||||
logrus.SetLevel(logrus.DebugLevel)
|
logrus.SetLevel(logrus.DebugLevel)
|
||||||
}
|
}
|
||||||
|
|
||||||
logrus.SetFormatter(&logrus.TextFormatter{
|
if args.Command != common.CommandStart {
|
||||||
DisableSorting: true,
|
logrus.SetOutput(io.Discard)
|
||||||
DisableLevelTruncation: true,
|
} else {
|
||||||
FullTimestamp: true,
|
logrus.SetFormatter(&logrus.TextFormatter{
|
||||||
ForceColors: true,
|
DisableSorting: true,
|
||||||
TimestampFormat: "01-02 15:04:05",
|
DisableLevelTruncation: true,
|
||||||
})
|
FullTimestamp: true,
|
||||||
|
ForceColors: true,
|
||||||
|
TimestampFormat: "01-02 15:04:05",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if args.Command == common.CommandReload {
|
if args.Command == common.CommandReload {
|
||||||
if err := apiUtils.ReloadServer(); err.HasError() {
|
if err := apiUtils.ReloadServer(); err.HasError() {
|
||||||
|
@ -59,15 +64,15 @@ func main() {
|
||||||
err = config.Validate(data).Error()
|
err = config.Validate(data).Error()
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
l.Fatal("config error: ", err)
|
log.Fatal("config error: ", err)
|
||||||
}
|
}
|
||||||
l.Printf("config OK")
|
log.Print("config OK")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg, err := config.Load()
|
cfg, err := config.Load()
|
||||||
if err.IsFatal() {
|
if err.IsFatal() {
|
||||||
l.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if args.Command == common.CommandListConfigs {
|
if args.Command == common.CommandListConfigs {
|
||||||
|
|
Loading…
Add table
Reference in a new issue