summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/caddy/main.go1
-rw-r--r--cmd/commandfuncs.go4
-rw-r--r--cmd/commands.go4
-rw-r--r--cmd/main.go13
-rw-r--r--cmd/proc_posix.go2
-rw-r--r--cmd/proc_windows.go2
6 files changed, 13 insertions, 13 deletions
diff --git a/cmd/caddy/main.go b/cmd/caddy/main.go
index 4743cd7..bd29b7b 100644
--- a/cmd/caddy/main.go
+++ b/cmd/caddy/main.go
@@ -40,6 +40,7 @@ import (
_ "github.com/caddyserver/caddy/v2/modules/caddytls"
_ "github.com/caddyserver/caddy/v2/modules/caddytls/standardstek"
_ "github.com/caddyserver/caddy/v2/modules/filestorage"
+ _ "github.com/caddyserver/caddy/v2/modules/logging"
)
func main() {
diff --git a/cmd/commandfuncs.go b/cmd/commandfuncs.go
index ec9d974..7c08c2e 100644
--- a/cmd/commandfuncs.go
+++ b/cmd/commandfuncs.go
@@ -387,7 +387,7 @@ func cmdAdaptConfig(fl Flags) (int, error) {
if warn.Directive != "" {
msg = fmt.Sprintf("%s: %s", warn.Directive, warn.Message)
}
- log.Printf("[WARNING][%s] %s:%d: %s", adaptCmdAdapterFlag, warn.File, warn.Line, msg)
+ fmt.Fprintf(os.Stderr, "[WARNING][%s] %s:%d: %s\n", adaptCmdAdapterFlag, warn.File, warn.Line, msg)
}
// print result to stdout
@@ -436,7 +436,7 @@ func cmdValidateConfig(fl Flags) (int, error) {
if warn.Directive != "" {
msg = fmt.Sprintf("%s: %s", warn.Directive, warn.Message)
}
- log.Printf("[WARNING][%s] %s:%d: %s", validateCmdAdapterFlag, warn.File, warn.Line, msg)
+ fmt.Fprintf(os.Stderr, "[WARNING][%s] %s:%d: %s\n", validateCmdAdapterFlag, warn.File, warn.Line, msg)
}
input = adaptedConfig
diff --git a/cmd/commands.go b/cmd/commands.go
index db9848d..7f43cd0 100644
--- a/cmd/commands.go
+++ b/cmd/commands.go
@@ -130,9 +130,9 @@ not quit after printing, and can be useful for troubleshooting.`,
RegisterCommand(Command{
Name: "stop",
Func: cmdStop,
- Short: "Gracefully stops the running Caddy process",
+ Short: "Gracefully stops a started Caddy process",
Long: `
-Stops the running Caddy process as gracefully as possible.
+Stops the background Caddy process as gracefully as possible.
On Windows, this stop is forceful and Caddy will not have an opportunity to
clean up any active locks; for a graceful shutdown on Windows, use Ctrl+C
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
}
diff --git a/cmd/proc_posix.go b/cmd/proc_posix.go
index 7a53193..199c614 100644
--- a/cmd/proc_posix.go
+++ b/cmd/proc_posix.go
@@ -24,7 +24,7 @@ import (
)
func gracefullyStopProcess(pid int) error {
- fmt.Printf("Graceful stop...")
+ fmt.Printf("Graceful stop...\n")
err := syscall.Kill(pid, syscall.SIGINT)
if err != nil {
return fmt.Errorf("kill: %v", err)
diff --git a/cmd/proc_windows.go b/cmd/proc_windows.go
index d333948..dd45234 100644
--- a/cmd/proc_windows.go
+++ b/cmd/proc_windows.go
@@ -23,7 +23,7 @@ import (
)
func gracefullyStopProcess(pid int) error {
- fmt.Printf("Forceful Stop...")
+ fmt.Printf("Forceful Stop...\n")
// process on windows will not stop unless forced with /f
cmd := exec.Command("taskkill", "/pid", strconv.Itoa(pid), "/f")
if err := cmd.Run(); err != nil {