mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-16 15:26:40 +00:00
Add structured logging for HTTP server errors
This commit is contained in:
21
proxy/log.go
Normal file
21
proxy/log.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
stdlog "log"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
const (
|
||||
// HTTP server type identifiers for logging
|
||||
logtagFieldHTTPServer = "http-server"
|
||||
logtagValueHTTPS = "https"
|
||||
logtagValueACME = "acme"
|
||||
logtagValueDebug = "debug"
|
||||
)
|
||||
|
||||
// newHTTPServerLogger creates a standard library logger that writes to logrus
|
||||
// with the specified server type field.
|
||||
func newHTTPServerLogger(logger *log.Logger, serverType string) *stdlog.Logger {
|
||||
return stdlog.New(logger.WithField(logtagFieldHTTPServer, serverType).WriterLevel(log.WarnLevel), "", 0)
|
||||
}
|
||||
Reference in New Issue
Block a user