Apply --disable-color to global logger

This commit is contained in:
世界
2023-03-13 11:23:00 +08:00
parent 7d22cf9b45
commit caad60da45
3 changed files with 14 additions and 23 deletions

View File

@@ -2,6 +2,7 @@ package main
import (
"os"
"time"
_ "github.com/sagernet/sing-box/include"
"github.com/sagernet/sing-box/log"
@@ -33,6 +34,9 @@ func main() {
}
func preRun(cmd *cobra.Command, args []string) {
if disableColor {
log.SetStdLogger(log.NewFactory(log.Formatter{BaseTime: time.Now(), DisableColors: true}, os.Stderr, nil).Logger())
}
if workingDir != "" {
if err := os.Chdir(workingDir); err != nil {
log.Fatal(err)