summaryrefslogtreecommitdiff
path: root/sigtrap_posix.go
diff options
context:
space:
mode:
authorMatt Holt <mholt@users.noreply.github.com>2019-10-28 14:39:37 -0600
committerGitHub <noreply@github.com>2019-10-28 14:39:37 -0600
commitb00dfd3965f400956c5bb5b388e9d54ef98052e5 (patch)
tree44517743815327f7ef63405b3a13e54f7f20c885 /sigtrap_posix.go
parent6c533558a3db4b30a6b7a81d19ac180fe2000ca2 (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 'sigtrap_posix.go')
-rw-r--r--sigtrap_posix.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/sigtrap_posix.go b/sigtrap_posix.go
index 63e6a31..4f081af 100644
--- a/sigtrap_posix.go
+++ b/sigtrap_posix.go
@@ -17,12 +17,12 @@
package caddy
import (
- "log"
"os"
"os/signal"
"syscall"
"github.com/mholt/certmagic"
+ "go.uber.org/zap"
)
// trapSignalsPosix captures POSIX-only signals.
@@ -34,23 +34,23 @@ func trapSignalsPosix() {
for sig := range sigchan {
switch sig {
case syscall.SIGQUIT:
- log.Println("[INFO] SIGQUIT: Quitting process immediately")
+ Log().Info("quitting process immediately", zap.String("signal", "SIGQUIT"))
certmagic.CleanUpOwnLocks() // try to clean up locks anyway, it's important
os.Exit(ExitCodeForceQuit)
case syscall.SIGTERM:
- log.Println("[INFO] SIGTERM: Shutting down apps then terminating")
+ Log().Info("shutting down apps then terminating", zap.String("signal", "SIGTERM"))
gracefulStop("SIGTERM")
case syscall.SIGUSR1:
- log.Println("[INFO] SIGUSR1: Not implemented")
+ Log().Info("not implemented", zap.String("signal", "SIGUSR1"))
case syscall.SIGUSR2:
- log.Println("[INFO] SIGUSR2: Not implemented")
+ Log().Info("not implemented", zap.String("signal", "SIGUSR2"))
case syscall.SIGHUP:
// ignore; this signal is sometimes sent outside of the user's control
- log.Println("[INFO] SIGHUP: Not implemented")
+ Log().Info("not implemented", zap.String("signal", "SIGHUP"))
}
}
}()