mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-27 19:19:57 +00:00
TUN-3747: Fix logging in Windows
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package logger
|
||||
|
||||
import "path/filepath"
|
||||
import (
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
var defaultConfig = createDefaultConfig()
|
||||
|
||||
|
@@ -6,6 +6,7 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/mattn/go-colorable"
|
||||
"github.com/rs/zerolog"
|
||||
fallbacklog "github.com/rs/zerolog/log"
|
||||
"github.com/urfave/cli/v2"
|
||||
@@ -109,15 +110,19 @@ func createFromContext(
|
||||
|
||||
func Create(loggerConfig *Config) *zerolog.Logger {
|
||||
if loggerConfig == nil {
|
||||
loggerConfig = &defaultConfig
|
||||
loggerConfig = &Config{
|
||||
defaultConfig.ConsoleConfig,
|
||||
nil,
|
||||
nil,
|
||||
defaultConfig.MinLevel,
|
||||
}
|
||||
}
|
||||
|
||||
return newZerolog(loggerConfig)
|
||||
}
|
||||
|
||||
func createConsoleLogger(config ConsoleConfig) io.Writer {
|
||||
return zerolog.ConsoleWriter{
|
||||
Out: os.Stderr,
|
||||
Out: colorable.NewColorableStderr(),
|
||||
NoColor: config.noColor,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user