Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/go-logr/logr
/ functions
Functions
347 in github.com/go-logr/logr
⨍
Functions
347
◇
Types & classes
79
↓ 54 callers
Method
Info
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 callers
Method
Error
Error logs an error, with the given message and key/value pairs as context. See Logger.Error for more details.
logr.go:444
↓ 28 callers
Function
New
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 callers
Function
Discard
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 callers
Function
ToSlogHandler
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 callers
Method
V
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 callers
Method
Run
()
examples/usage_example.go:107
↓ 18 callers
Function
newSink
(fn func(prefix, args string), formatter Formatter)
funcr/funcr.go:74
↓ 17 callers
Function
FromSlogHandler
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 callers
Function
NewFormatter
NewFormatter constructs a Formatter which emits a JSON-like key=value format.
funcr/funcr.go:201
↓ 17 callers
Function
NewJSON
NewJSON returns a logr.Logger which is implemented by an arbitrary function and produces JSON output.
funcr/funcr.go:59
↓ 17 callers
Method
WithValues
WithValues returns a new LogSink with additional key/value pairs. See Logger.WithValues for more details.
logr.go:448
↓ 15 callers
Function
NewFormatterJSON
NewFormatterJSON constructs a Formatter which emits strict JSON.
funcr/funcr.go:206
↓ 15 callers
Method
WithCallDepth
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 callers
Method
WithName
WithName returns a new LogSink with the specified name appended. See Logger.WithName for more details.
logr.go:452
↓ 14 callers
Function
New
New returns a logr.Logger which is implemented by an arbitrary function.
funcr/funcr.go:53
↓ 12 callers
Function
makeSlogJSONLogger
slogSink wrapper of slog's JSONHandler, for comparison
benchmark/benchmark_slog_test.go:78
↓ 10 callers
Function
makeKV
(args ...any)
funcr/funcr_test.go:681
↓ 9 callers
Method
Enabled
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 callers
Function
NewStdoutLogger
NewStdoutLogger returns a logr.Logger that prints to stdout.
example_test.go:27
↓ 9 callers
Method
String
()
funcr/funcr_test.go:79
↓ 8 callers
Method
GetSink
GetSink returns the stored sink.
logr.go:230
↓ 7 callers
Method
WithGroup
(name string)
slogr.go:99
↓ 6 callers
Method
Helper
()
testr/testr.go:56
↓ 6 callers
Method
Info
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 callers
Method
setSink
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 callers
Method
AddValues
AddValues adds key-value pairs to the set of saved values to be logged with each log line.
funcr/funcr.go:891
↓ 5 callers
Method
Handle
(ctx context.Context, record slog.Record)
slogr.go:97
↓ 5 callers
Method
WithCallStackHelper
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 callers
Function
doError
go:noinline
benchmark/benchmark_test.go:72
↓ 5 callers
Function
doInfoOneArg
go:noinline
benchmark/benchmark_test.go:28
↓ 5 callers
Function
doInfoSeveralArgs
go:noinline
benchmark/benchmark_test.go:35
↓ 5 callers
Function
doInfoWithValues
go:noinline
benchmark/benchmark_test.go:44
↓ 5 callers
Function
doV0Info
go:noinline
benchmark/benchmark_test.go:54
↓ 5 callers
Function
doV9Info
go:noinline
benchmark/benchmark_test.go:63
↓ 5 callers
Function
helper
(log logr.Logger, msg string)
funcr/example/main.go:35
↓ 4 callers
Function
RunSlogTests
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 callers
Method
WithAttrs
(attrs []slog.Attr)
slogr.go:98
↓ 4 callers
Method
WithName
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 callers
Method
colon
()
funcr/funcr.go:389
↓ 4 callers
Method
comma
()
funcr/funcr.go:382
↓ 4 callers
Function
doWithName
go:noinline
benchmark/benchmark_test.go:90
↓ 4 callers
Function
doWithValues
go:noinline
benchmark/benchmark_test.go:82
↓ 4 callers
Method
quoted
(str string, escape bool)
funcr/funcr.go:374
↓ 4 callers
Method
sanitize
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 callers
Method
write
(msgType, prefix, args string)
funcr/example_formatter_test.go:68
↓ 3 callers
Method
AddCallDepth
AddCallDepth increases the number of stack-frames to skip when attributing the log line to a file and line.
funcr/funcr.go:909
↓ 3 callers
Method
AddName
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 callers
Function
FromContext
FromContext returns a Logger from ctx or an error if no Logger is found.
context_slog.go:29
↓ 3 callers
Method
GetCallStackHelper
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 callers
Method
Log
(args ...any)
testr/testr.go:57
↓ 3 callers
Function
NewWithInterface
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 callers
Method
WithValues
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 callers
Method
pretty
(value any)
funcr/funcr.go:396
↓ 3 callers
Method
render
render produces a log line, ready to use.
funcr/funcr.go:264
↓ 2 callers
Method
FormatError
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 callers
Method
FormatInfo
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 callers
Method
GetUnderlying
()
testr/testr.go:91
↓ 2 callers
Method
GetV
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 callers
Function
Helper
(log logr.Logger, msg string)
testr/testr_test.go:79
↓ 2 callers
Method
IsZero
IsZero returns true if this logger is an uninitialized zero value
logr.go:405
↓ 2 callers
Function
NewContext
NewContext returns a new Context, derived from ctx, which carries the provided Logger.
context_slog.go:75
↓ 2 callers
Function
NewWithOptions
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 callers
Function
addPrefix
(prefix, name string)
sloghandler.go:162
↓ 2 callers
Function
attrToKVs
attrToKVs appends a slog.Attr to a logr-style kvList. It handle slog Groups and other details of slog.
sloghandler.go:142
↓ 2 callers
Function
attrToKVs
attrToKVs appends a slog.Attr to a logr-style kvList. It handle slog Groups and other details of slog.
funcr/slogsink.go:65
↓ 2 callers
Method
caller
()
funcr/funcr.go:717
↓ 2 callers
Function
doErrorValue
go:noinline
benchmark/benchmark_test.go:125
↓ 2 callers
Function
doMarshalerValue
go:noinline
benchmark/benchmark_test.go:138
↓ 2 callers
Function
doStringerValue
go:noinline
benchmark/benchmark_test.go:112
↓ 2 callers
Function
doWithCallDepth
go:noinline
benchmark/benchmark_test.go:98
↓ 2 callers
Method
flatten
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 callers
Method
levelFromSlog
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 callers
Method
log
(err error, msg string, level slog.Level, kvList ...interface{})
slogsink.go:81
↓ 2 callers
Function
newFormatter
(opts Options, outfmt outputFormat)
funcr/funcr.go:214
↓ 2 callers
Function
newLoggerInterfaceWithOptions
(t TestingT, opts Options)
testr/testr.go:68
↓ 2 callers
Method
nonStringKey
(v any)
funcr/funcr.go:735
↓ 2 callers
Function
prettyString
(s string)
funcr/funcr.go:631
↓ 2 callers
Function
ptrstr
(s string)
funcr/funcr_test.go:36
↓ 1 callers
Method
Enabled
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 callers
Method
Error
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 callers
Function
FromContextAsSlogLogger
FromContextAsSlogLogger returns a slog.Logger from ctx or nil if no such Logger is found.
context_slog.go:47
↓ 1 callers
Function
FromContextOrDiscard
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 callers
Method
Get
(key string)
examples/usage_example.go:65
↓ 1 callers
Method
GetLevel
GetLevel is used for black box unit testing.
sloghandler.go:51
↓ 1 callers
Method
GetUnderlying
()
funcr/funcr.go:71
↓ 1 callers
Function
Helper
(log logr.Logger, msg string)
testing/test_test.go:42
↓ 1 callers
Method
Info
(level int, msg string, kvs ...any)
examples/tab_logger.go:46
↓ 1 callers
Method
Init
Init receives optional information about the logr library for LogSink implementations that need it.
logr.go:429
↓ 1 callers
Method
MarshalLog
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 callers
Method
MarshalText
()
funcr/funcr_test.go:43
↓ 1 callers
Function
New
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 callers
Function
NewContextWithSlogLogger
NewContextWithSlogLogger returns a new Context, derived from ctx, which carries the provided slog.Logger.
context_slog.go:81
↓ 1 callers
Function
NewController
(log logr.Logger, objectKind string)
examples/usage_example.go:144
↓ 1 callers
Function
NewStdoutLogger
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 callers
Function
NewTabLogger
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 callers
Method
Save
(obj Object)
examples/usage_example.go:75
↓ 1 callers
Method
String
()
example_marshaler_test.go:29
↓ 1 callers
Method
WatchNext
()
examples/usage_example.go:84
↓ 1 callers
Method
WithCallDepth
(depth int)
funcr/funcr.go:176
next →
1–100 of 347, ranked by callers