diff options
author | Matt Holt <mholt@users.noreply.github.com> | 2019-10-28 14:39:37 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-28 14:39:37 -0600 |
commit | b00dfd3965f400956c5bb5b388e9d54ef98052e5 (patch) | |
tree | 44517743815327f7ef63405b3a13e54f7f20c885 /cmd/main.go | |
parent | 6c533558a3db4b30a6b7a81d19ac180fe2000ca2 (diff) |
v2: Logging! (#2831)
* logging: Initial implementation
* logging: More encoder formats, better defaults
* logging: Fix repetition bug with FilterEncoder; add more presets
* logging: DiscardWriter; delete or no-op logs that discard their output
* logging: Add http.handlers.log module; enhance Replacer methods
The Replacer interface has new methods to customize how to handle empty
or unrecognized placeholders. Closes #2815.
* logging: Overhaul HTTP logging, fix bugs, improve filtering, etc.
* logging: General cleanup, begin transitioning to using new loggers
* Fixes after merge conflict
Diffstat (limited to 'cmd/main.go')
-rw-r--r-- | cmd/main.go | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/cmd/main.go b/cmd/main.go index 6447e73..9997cc4 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -20,7 +20,6 @@ import ( "fmt" "io" "io/ioutil" - "log" "net" "os" "strconv" @@ -38,7 +37,7 @@ func Main() { switch len(os.Args) { case 0: - log.Printf("[FATAL] no arguments provided by OS; args[0] must be command") + fmt.Printf("[FATAL] no arguments provided by OS; args[0] must be command\n") os.Exit(caddy.ExitCodeFailedStartup) case 1: os.Args = append(os.Args, "help") @@ -49,9 +48,9 @@ func Main() { if !ok { if strings.HasPrefix(os.Args[1], "-") { // user probably forgot to type the subcommand - log.Println("[ERROR] first argument must be a subcommand; see 'caddy help'") + fmt.Println("[ERROR] first argument must be a subcommand; see 'caddy help'") } else { - log.Printf("[ERROR] '%s' is not a recognized subcommand; see 'caddy help'", os.Args[1]) + fmt.Printf("[ERROR] '%s' is not a recognized subcommand; see 'caddy help'\n", os.Args[1]) } os.Exit(caddy.ExitCodeFailedStartup) } @@ -63,13 +62,13 @@ func Main() { err := fs.Parse(os.Args[2:]) if err != nil { - log.Println(err) + fmt.Println(err) os.Exit(caddy.ExitCodeFailedStartup) } exitCode, err := subcommand.Func(Flags{fs}) if err != nil { - log.Printf("%s: %v", subcommand.Name, err) + fmt.Printf("%s: %v\n", subcommand.Name, err) } os.Exit(exitCode) @@ -149,7 +148,7 @@ func loadConfig(configFile, adapterName string) ([]byte, error) { if warn.Directive != "" { msg = fmt.Sprintf("%s: %s", warn.Directive, warn.Message) } - fmt.Printf("[WARNING][%s] %s:%d: %s", adapterName, warn.File, warn.Line, msg) + fmt.Printf("[WARNING][%s] %s:%d: %s\n", adapterName, warn.File, warn.Line, msg) } config = adaptedConfig } |