MCPcopy Create free account

hub / github.com/go-logr/logr / functions

Functions347 in github.com/go-logr/logr

↓ 54 callersMethodInfo
Info logs a non-error message with the given key/value pairs as context. The level argument is provided for optional logging. This method will only b
logr.go:440
↓ 32 callersMethodError
Error logs an error, with the given message and key/value pairs as context. See Logger.Error for more details.
logr.go:444
↓ 28 callersFunctionNew
New returns a new Logger instance. This is primarily used by libraries implementing LogSink, rather than end users. Passing a nil sink will create a
logr.go:213
↓ 27 callersFunctionDiscard
Discard returns a Logger that discards all messages logged to it. It can be used whenever the caller is not interested in the logs. Logger instances
discard.go:22
↓ 24 callersFunctionToSlogHandler
ToSlogHandler returns a slog.Handler which writes to the same sink as the Logger. The returned logger writes all records with level >= slog.LevelErro
slogr.go:59
↓ 23 callersMethodV
V returns a new Logger instance for a specific verbosity level, relative to this Logger. In other words, V-levels are additive. A higher verbosity l
logr.go:308
↓ 19 callersMethodRun
()
examples/usage_example.go:107
↓ 18 callersFunctionnewSink
(fn func(prefix, args string), formatter Formatter)
funcr/funcr.go:74
↓ 17 callersFunctionFromSlogHandler
FromSlogHandler returns a Logger which writes to the slog.Handler. The logr verbosity level is mapped to slog levels such that V(0) becomes slog.Leve
slogr.go:31
↓ 17 callersFunctionNewFormatter
NewFormatter constructs a Formatter which emits a JSON-like key=value format.
funcr/funcr.go:201
↓ 17 callersFunctionNewJSON
NewJSON returns a logr.Logger which is implemented by an arbitrary function and produces JSON output.
funcr/funcr.go:59
↓ 17 callersMethodWithValues
WithValues returns a new LogSink with additional key/value pairs. See Logger.WithValues for more details.
logr.go:448
↓ 15 callersFunctionNewFormatterJSON
NewFormatterJSON constructs a Formatter which emits strict JSON.
funcr/funcr.go:206
↓ 15 callersMethodWithCallDepth
WithCallDepth returns a LogSink that will offset the call stack by the specified number of frames when logging call site information. If depth is 0,
logr.go:477
↓ 15 callersMethodWithName
WithName returns a new LogSink with the specified name appended. See Logger.WithName for more details.
logr.go:452
↓ 14 callersFunctionNew
New returns a logr.Logger which is implemented by an arbitrary function.
funcr/funcr.go:53
↓ 12 callersFunctionmakeSlogJSONLogger
slogSink wrapper of slog's JSONHandler, for comparison
benchmark/benchmark_slog_test.go:78
↓ 10 callersFunctionmakeKV
(args ...any)
funcr/funcr_test.go:681
↓ 9 callersMethodEnabled
Enabled tests whether this LogSink is enabled at the specified V-level. For example, commandline flags might be used to set the logging verbosity and
logr.go:434
↓ 9 callersFunctionNewStdoutLogger
NewStdoutLogger returns a logr.Logger that prints to stdout.
example_test.go:27
↓ 9 callersMethodString
()
funcr/funcr_test.go:79
↓ 8 callersMethodGetSink
GetSink returns the stored sink.
logr.go:230
↓ 7 callersMethodWithGroup
(name string)
slogr.go:99
↓ 6 callersMethodHelper
()
testr/testr.go:56
↓ 6 callersMethodInfo
Info logs a non-error message with the given key/value pairs as context. The msg argument should be used to add some constant description to the log
logr.go:272
↓ 6 callersMethodsetSink
setSink stores the sink and updates any related fields. It mutates the logger and thus is only safe to use for loggers that are not currently being us
logr.go:225
↓ 5 callersMethodAddValues
AddValues adds key-value pairs to the set of saved values to be logged with each log line.
funcr/funcr.go:891
↓ 5 callersMethodHandle
(ctx context.Context, record slog.Record)
slogr.go:97
↓ 5 callersMethodWithCallStackHelper
WithCallStackHelper returns a new Logger instance that skips the direct caller when logging call site information, if possible. This is useful for us
logr.go:388
↓ 5 callersFunctiondoError
go:noinline
benchmark/benchmark_test.go:72
↓ 5 callersFunctiondoInfoOneArg
go:noinline
benchmark/benchmark_test.go:28
↓ 5 callersFunctiondoInfoSeveralArgs
go:noinline
benchmark/benchmark_test.go:35
↓ 5 callersFunctiondoInfoWithValues
go:noinline
benchmark/benchmark_test.go:44
↓ 5 callersFunctiondoV0Info
go:noinline
benchmark/benchmark_test.go:54
↓ 5 callersFunctiondoV9Info
go:noinline
benchmark/benchmark_test.go:63
↓ 5 callersFunctionhelper
(log logr.Logger, msg string)
funcr/example/main.go:35
↓ 4 callersFunctionRunSlogTests
RunSlogTests runs slogtest.TestHandler on a given slog.Handler, which is expected to emit JSON into the provided buffer.
internal/testhelp/slog.go:35
↓ 4 callersMethodWithAttrs
(attrs []slog.Attr)
slogr.go:98
↓ 4 callersMethodWithName
WithName returns a new Logger instance with the specified name element added to the Logger's name. Successive calls with WithName append additional s
logr.go:341
↓ 4 callersMethodcolon
()
funcr/funcr.go:389
↓ 4 callersMethodcomma
()
funcr/funcr.go:382
↓ 4 callersFunctiondoWithName
go:noinline
benchmark/benchmark_test.go:90
↓ 4 callersFunctiondoWithValues
go:noinline
benchmark/benchmark_test.go:82
↓ 4 callersMethodquoted
(str string, escape bool)
funcr/funcr.go:374
↓ 4 callersMethodsanitize
sanitize ensures that a list of key-value pairs has a value for every key (adding a value if needed) and that each key is a string (substituting a key
funcr/funcr.go:753
↓ 4 callersMethodwrite
(msgType, prefix, args string)
funcr/example_formatter_test.go:68
↓ 3 callersMethodAddCallDepth
AddCallDepth increases the number of stack-frames to skip when attributing the log line to a file and line.
funcr/funcr.go:909
↓ 3 callersMethodAddName
AddName appends the specified name. funcr uses '/' characters to separate name elements. Callers should not pass '/' in the provided name string, bu
funcr/funcr.go:882
↓ 3 callersFunctionFromContext
FromContext returns a Logger from ctx or an error if no Logger is found.
context_slog.go:29
↓ 3 callersMethodGetCallStackHelper
GetCallStackHelper returns a function that must be called to mark the direct caller as helper function when logging call site information.
logr.go:501
↓ 3 callersMethodLog
(args ...any)
testr/testr.go:57
↓ 3 callersFunctionNewWithInterface
NewWithInterface returns a logr.Logger that prints through a TestingT object. In contrast to the simpler New, output formatting can be configured.
testr/testr.go:63
↓ 3 callersMethodWithValues
WithValues returns a new Logger instance with additional key/value pairs. See Info for documentation on how key/value pairs work.
logr.go:328
↓ 3 callersMethodpretty
(value any)
funcr/funcr.go:396
↓ 3 callersMethodrender
render produces a log line, ready to use.
funcr/funcr.go:264
↓ 2 callersMethodFormatError
FormatError renders an Error log message into strings. The prefix will be empty when no names were set (via AddNames), or when the output is configur
funcr/funcr.go:857
↓ 2 callersMethodFormatInfo
FormatInfo renders an Info log message into strings. The prefix will be empty when no names were set (via AddNames), or when the output is configured
funcr/funcr.go:834
↓ 2 callersMethodGetUnderlying
()
testr/testr.go:91
↓ 2 callersMethodGetV
GetV returns the verbosity level of the logger. If the logger's LogSink is nil as in the Discard logger, this will always return 0.
logr.go:321
↓ 2 callersFunctionHelper
(log logr.Logger, msg string)
testr/testr_test.go:79
↓ 2 callersMethodIsZero
IsZero returns true if this logger is an uninitialized zero value
logr.go:405
↓ 2 callersFunctionNewContext
NewContext returns a new Context, derived from ctx, which carries the provided Logger.
context_slog.go:75
↓ 2 callersFunctionNewWithOptions
NewWithOptions returns a logr.Logger that prints through a testing.T object. In contrast to the simpler New, output formatting can be configured.
testr/testr.go:47
↓ 2 callersFunctionaddPrefix
(prefix, name string)
sloghandler.go:162
↓ 2 callersFunctionattrToKVs
attrToKVs appends a slog.Attr to a logr-style kvList. It handle slog Groups and other details of slog.
sloghandler.go:142
↓ 2 callersFunctionattrToKVs
attrToKVs appends a slog.Attr to a logr-style kvList. It handle slog Groups and other details of slog.
funcr/slogsink.go:65
↓ 2 callersMethodcaller
()
funcr/funcr.go:717
↓ 2 callersFunctiondoErrorValue
go:noinline
benchmark/benchmark_test.go:125
↓ 2 callersFunctiondoMarshalerValue
go:noinline
benchmark/benchmark_test.go:138
↓ 2 callersFunctiondoStringerValue
go:noinline
benchmark/benchmark_test.go:112
↓ 2 callersFunctiondoWithCallDepth
go:noinline
benchmark/benchmark_test.go:98
↓ 2 callersMethodflatten
flatten renders a list of key-value pairs into a buffer. If continuing is true, it assumes that the buffer has previous values and will emit a separa
funcr/funcr.go:336
↓ 2 callersMethodlevelFromSlog
levelFromSlog adjusts the level by the logger's verbosity and negates it. It ensures that the result is >= 0. This is necessary because the result is
sloghandler.go:185
↓ 2 callersMethodlog
(err error, msg string, level slog.Level, kvList ...interface{})
slogsink.go:81
↓ 2 callersFunctionnewFormatter
(opts Options, outfmt outputFormat)
funcr/funcr.go:214
↓ 2 callersFunctionnewLoggerInterfaceWithOptions
(t TestingT, opts Options)
testr/testr.go:68
↓ 2 callersMethodnonStringKey
(v any)
funcr/funcr.go:735
↓ 2 callersFunctionprettyString
(s string)
funcr/funcr.go:631
↓ 2 callersFunctionptrstr
(s string)
funcr/funcr_test.go:36
↓ 1 callersMethodEnabled
Enabled tests whether this Logger is enabled. For example, commandline flags might be used to set the logging verbosity and disable some info logs.
logr.go:256
↓ 1 callersMethodError
Error logs an error, with the given message and key/value pairs as context. It functions similarly to Info, but may have unique behavior, and should b
logr.go:294
↓ 1 callersFunctionFromContextAsSlogLogger
FromContextAsSlogLogger returns a slog.Logger from ctx or nil if no such Logger is found.
context_slog.go:47
↓ 1 callersFunctionFromContextOrDiscard
FromContextOrDiscard returns a Logger from ctx. If no Logger is found, this returns a Logger that discards all log messages.
context_slog.go:66
↓ 1 callersMethodGet
(key string)
examples/usage_example.go:65
↓ 1 callersMethodGetLevel
GetLevel is used for black box unit testing.
sloghandler.go:51
↓ 1 callersMethodGetUnderlying
()
funcr/funcr.go:71
↓ 1 callersFunctionHelper
(log logr.Logger, msg string)
testing/test_test.go:42
↓ 1 callersMethodInfo
(level int, msg string, kvs ...any)
examples/tab_logger.go:46
↓ 1 callersMethodInit
Init receives optional information about the logr library for LogSink implementations that need it.
logr.go:429
↓ 1 callersMethodMarshalLog
MarshalLog can be used to: - ensure that structs are not logged as strings when the original value has a String method: return a different type withou
logr.go:519
↓ 1 callersMethodMarshalText
()
funcr/funcr_test.go:43
↓ 1 callersFunctionNew
New returns a logr.Logger that prints through a testing.T object. Info logs are only enabled at V(0).
testr/testr.go:29
↓ 1 callersFunctionNewContextWithSlogLogger
NewContextWithSlogLogger returns a new Context, derived from ctx, which carries the provided slog.Logger.
context_slog.go:81
↓ 1 callersFunctionNewController
(log logr.Logger, objectKind string)
examples/usage_example.go:144
↓ 1 callersFunctionNewStdoutLogger
NewStdoutLogger returns a logr.Logger that prints to stdout. It demonstrates how to implement a custom With* function which controls whether INFO or E
funcr/example_formatter_test.go:31
↓ 1 callersFunctionNewTabLogger
NewTabLogger is the main entry-point to this implementation. App developers call this somewhere near main() and thenceforth only deal with logr.Logge
examples/tab_logger.go:88
↓ 1 callersMethodSave
(obj Object)
examples/usage_example.go:75
↓ 1 callersMethodString
()
example_marshaler_test.go:29
↓ 1 callersMethodWatchNext
()
examples/usage_example.go:84
↓ 1 callersMethodWithCallDepth
(depth int)
funcr/funcr.go:176
next →1–100 of 347, ranked by callers