Skip to content

Commit

Permalink
Document variable names for request.CTX and mlog.Logger (mattermost#2…
Browse files Browse the repository at this point in the history
  • Loading branch information
hanzei authored Jan 26, 2024
1 parent 223c9c7 commit 929ab6b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/public/shared/mlog/mlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const (
DefaultMetricsUpdateFreqMillis = 15000
)

// LoggerIFace should be abbreviated as `logger`.
type LoggerIFace interface {
IsLevelEnabled(Level) bool
Trace(string, ...Field)
Expand Down Expand Up @@ -169,6 +170,8 @@ func Map[M ~map[K]V, K comparable, V any](key string, val M) Field {
// so that there are no allocations on the heap each interface method invocation. Normally not
// something to be concerned about, but logging calls for disabled levels should have as little CPU
// and memory impact as possible. Most of these wrapper calls will be inlined as well.
//
// Logger should be abbreviated as `logger`.
type Logger struct {
log *logr.Logger
lockConfig *int32
Expand Down
2 changes: 2 additions & 0 deletions server/public/shared/request/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/mattermost/mattermost/server/public/shared/mlog"
)

// Context should be abbreviated as `rctx`.
type Context struct {
t i18n.TranslateFunc
session model.Session
Expand Down Expand Up @@ -148,6 +149,7 @@ func (c *Context) With(f func(ctx CTX) CTX) CTX {
return f(c)
}

// CTX should be abbreviated as `rctx`.
type CTX interface {
T(string, ...interface{}) string
GetT() i18n.TranslateFunc
Expand Down

0 comments on commit 929ab6b

Please sign in to comment.