Add some middleware
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2022-01-19 03:23:54 +01:00
parent 9449b37ab1
commit e3ff8065f1
3 changed files with 55 additions and 15 deletions

View File

@@ -57,6 +57,7 @@ func ActionServe(c *cli.Context) error {
// Setup loggers
rootLogger := getRootLogger(cfg.LogLevel)
serverLogger := rootLogger.Named("SERV")
accessLogger := rootLogger.Named("ACCS")
// Setup contexts for clean shutdown
rootCtx, rootCancel := signal.NotifyContext(context.Background(), os.Interrupt)
@@ -70,6 +71,7 @@ func ActionServe(c *cli.Context) error {
srv := gpaste.NewHTTPServer(cfg)
srv.Addr = cfg.ListenAddr
srv.Logger = serverLogger
srv.AccessLogger = accessLogger
// Wait for cancel
go func() {