kubernetes/vendor/github.com/go-logr/logr/funcr/funcr.go

// New returns a logr.Logger which is implemented by an arbitrary function.
func New(fn func(prefix, args string), opts Options) logr.Logger {}

// NewJSON returns a logr.Logger which is implemented by an arbitrary function
// and produces JSON output.
func NewJSON(fn func(obj string), opts Options) logr.Logger {}

type Underlier

func newSink(fn func(prefix, args string), formatter Formatter) logr.LogSink {}

type Options

type MessageClass

const None

const All

const Info

const Error

type fnlogger

func (l fnlogger) WithName(name string) logr.LogSink {}

func (l fnlogger) WithValues(kvList ...any) logr.LogSink {}

func (l fnlogger) WithCallDepth(depth int) logr.LogSink {}

func (l fnlogger) Info(level int, msg string, kvList ...any) {}

func (l fnlogger) Error(err error, msg string, kvList ...any) {}

func (l fnlogger) GetUnderlying() func(prefix, args string) {}

var _

var _

var _

// NewFormatter constructs a Formatter which emits a JSON-like key=value format.
func NewFormatter(opts Options) Formatter {}

// NewFormatterJSON constructs a Formatter which emits strict JSON.
func NewFormatterJSON(opts Options) Formatter {}

const defaultTimestampFormat

const defaultMaxLogDepth

func newFormatter(opts Options, outfmt outputFormat) Formatter {}

type Formatter

type outputFormat

const outputKeyValue

const outputJSON

type groupDef

type PseudoStruct

// render produces a log line, ready to use.
func (f Formatter) render(builtins, args []any) string {}

// renderGroup returns a string representation of the named group with rendered
// values and args.  If the name is empty, this will return the values and args,
// joined.  If the name is not empty, this will return a single key-value pair,
// where the value is a grouping of the values and args.  If the values and
// args are both empty, this will return an empty string, even if the name was
// specified.
func (f Formatter) renderGroup(name string, values string, args string) string {}

// flatten renders a list of key-value pairs into a buffer.  If escapeKeys is
// true, the keys are assumed to have non-JSON-compatible characters in them
// and must be evaluated for escapes.
//
// This function returns a potentially modified version of kvList, which
// ensures that there is a value for every key (adding a value if needed) and
// that each key is a string (substituting a key if needed).
func (f Formatter) flatten(buf *bytes.Buffer, kvList []any, escapeKeys bool) []any {}

func (f Formatter) quoted(str string, escape bool) string {}

func (f Formatter) comma() byte {}

func (f Formatter) colon() byte {}

func (f Formatter) pretty(value any) string {}

const flagRawStruct

// TODO: This is not fast. Most of the overhead goes here.
func (f Formatter) prettyWithFlags(value any, flags uint32, depth int) string {}

func prettyString(s string) string {}

// needsEscape determines whether the input string needs to be escaped or not,
// without doing any allocations.
func needsEscape(s string) bool {}

func isEmpty(v reflect.Value) bool {}

func invokeMarshaler(m logr.Marshaler) (ret any) {}

func invokeStringer(s fmt.Stringer) (ret string) {}

func invokeError(e error) (ret string) {}

type Caller

func (f Formatter) caller() Caller {}

const noValue

func (f Formatter) nonStringKey(v any) string {}

// snippet produces a short snippet string of an arbitrary value.
func (f Formatter) snippet(v any) string {}

// 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
// if needed).
func (f Formatter) sanitize(kvList []any) []any {}

// startGroup opens a new group scope (basically a sub-struct), which locks all
// the current saved values and starts them anew.  This is needed to satisfy
// slog.
func (f *Formatter) startGroup(name string) {}

// Init configures this Formatter from runtime info, such as the call depth
// imposed by logr itself.
// Note that this receiver is a pointer, so depth can be saved.
func (f *Formatter) Init(info logr.RuntimeInfo) {}

// Enabled checks whether an info message at the given level should be logged.
func (f Formatter) Enabled(level int) bool {}

// GetDepth returns the current depth of this Formatter.  This is useful for
// implementations which do their own caller attribution.
func (f Formatter) GetDepth() int {}

// 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 for JSON.
func (f Formatter) FormatInfo(level int, msg string, kvList []any) (prefix, argsStr string) {}

// 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
// configured for JSON.
func (f Formatter) FormatError(err error, msg string, kvList []any) (prefix, argsStr string) {}

// AddName appends the specified name.  funcr uses '/' characters to separate
// name elements.  Callers should not pass '/' in the provided name string, but
// this library does not actually enforce that.
func (f *Formatter) AddName(name string) {}

// AddValues adds key-value pairs to the set of saved values to be logged with
// each log line.
func (f *Formatter) AddValues(kvList []any) {}

// AddCallDepth increases the number of stack-frames to skip when attributing
// the log line to a file and line.
func (f *Formatter) AddCallDepth(depth int) {}