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

Function parseMethodLogCfg

pkg/rpcmiddleware/rpclog/utils.go:111–130  ·  view source on GitHub ↗
(opt string)

Source from the content-addressed store, hash-verified

109}
110
111func parseMethodLogCfg(opt string) (string, methodLogConfig) {
112 optParts := strings.SplitN(opt, ":", 2)
113 methodName := optParts[0]
114 if len(optParts) == 1 {
115 return methodName, methodLogConfig{IgnoreSuccess: true}
116 }
117 ignoredErrors := strings.Split(optParts[1], ";")
118 isSuccessIgnored := ignoredErrors[0] == ""
119 if isSuccessIgnored {
120 ignoredErrors = ignoredErrors[1:]
121 }
122 ignoredErrorSet := make(map[string]struct{}, len(ignoredErrors))
123 for _, ignoredMethodError := range ignoredErrors {
124 ignoredErrorSet[ignoredMethodError] = struct{}{}
125 }
126 return methodName, methodLogConfig{
127 IgnoreSuccess: isSuccessIgnored,
128 IgnoredErrors: ignoredErrorSet,
129 }
130}

Callers 2

WithIgnoreMethodsFunction · 0.85

Calls

no outgoing calls