MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / Printf

Method Printf

pkg/oauth/server.go:141–162  ·  view source on GitHub ↗
(format string, v ...any)

Source from the content-addressed store, hash-verified

139}
140
141func (l *osinLogger) Printf(format string, v ...any) {
142 logger := log.FromContext(l.ctx)
143 if strings.HasPrefix(format, osinErrorFormat) && len(v) >= 2 {
144 format = strings.TrimPrefix(format, osinErrorFormat)
145 logger = logger.WithField("oauth_error", v[0])
146 if err, ok := v[1].(error); ok {
147 logger = logger.WithField("oauth_error_cause", err)
148 }
149 v = v[2:]
150 if len(v) >= 1 {
151 switch format {
152 case osinAuthCodeErrorFormat:
153 logger.WithField("oauth_error_message", v[0]).Warn("OAuth authorization_code error")
154 return
155 case osinRefreshTokenErrorFormat:
156 logger.WithField("oauth_error_message", v[0]).Warn("OAuth refresh_token error")
157 return
158 }
159 }
160 }
161 logger.Warnf("OAuth internal error: "+format, v...)
162}
163
164// These errors map to errors in the osin library.
165var (

Callers

nothing calls this directly

Calls 6

FromContextFunction · 0.92
TrimPrefixMethod · 0.80
WithFieldMethod · 0.65
WarnMethod · 0.65
WarnfMethod · 0.65
HasPrefixMethod · 0.45

Tested by

no test coverage detected