mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-04-04 13:47:36 +03:00
Minor tweaks
This commit is contained in:
parent
e90f52f375
commit
76d46ec646
8 changed files with 45 additions and 47 deletions
|
@ -11,19 +11,38 @@ import (
|
|||
"unicode/utf8"
|
||||
)
|
||||
|
||||
// Log tags
|
||||
const (
|
||||
tagStartup = "startup"
|
||||
tagHTTP = "http"
|
||||
tagPublish = "publish"
|
||||
tagSubscribe = "subscribe"
|
||||
tagFirebase = "firebase"
|
||||
tagSMTP = "smtp" // Receive email
|
||||
tagEmail = "email" // Send email
|
||||
tagFileCache = "file_cache"
|
||||
tagMessageCache = "message_cache"
|
||||
tagStripe = "stripe"
|
||||
tagAccount = "account"
|
||||
tagManager = "manager"
|
||||
tagResetter = "resetter"
|
||||
tagWebsocket = "websocket"
|
||||
tagMatrix = "matrix"
|
||||
)
|
||||
|
||||
// logr creates a new log event with HTTP request fields
|
||||
func logr(r *http.Request) *log.Event {
|
||||
return log.Fields(httpContext(r))
|
||||
return log.Tag(tagHTTP).Fields(httpContext(r)) // Tag may be overwritten
|
||||
}
|
||||
|
||||
// logr creates a new log event with visitor fields
|
||||
// logv creates a new log event with visitor fields
|
||||
func logv(v *visitor) *log.Event {
|
||||
return log.With(v)
|
||||
}
|
||||
|
||||
// logr creates a new log event with HTTP request and visitor fields
|
||||
// logvr creates a new log event with HTTP request and visitor fields
|
||||
func logvr(v *visitor, r *http.Request) *log.Event {
|
||||
return logv(v).Fields(httpContext(r))
|
||||
return logr(r).With(v)
|
||||
}
|
||||
|
||||
// logvrm creates a new log event with HTTP request, visitor fields and message fields
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue