utils

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TraceLevel designates finer-grained informational events than the Debug.
	LevelTrace = slog.LevelDebug * 2
)

Variables

View Source
var LDAPScopes = map[gldap.Scope]string{
	gldap.BaseObject:   "base",
	gldap.SingleLevel:  "one",
	gldap.WholeSubtree: "sub",
}

LDAPScopes maps gldap.Scope to string for logging purposes.

Functions

This section is empty.

Types

type HashicorpLoggerWrapper

type HashicorpLoggerWrapper struct {
	Logger *slog.Logger
	// contains filtered or unexported fields
}

func (HashicorpLoggerWrapper) Debug

func (logger HashicorpLoggerWrapper) Debug(msg string, args ...interface{})

Emit a message and key/value pairs at the DEBUG level.

func (HashicorpLoggerWrapper) Error

func (logger HashicorpLoggerWrapper) Error(msg string, args ...interface{})

Emit a message and key/value pairs at the ERROR level.

func (HashicorpLoggerWrapper) GetLevel

func (logger HashicorpLoggerWrapper) GetLevel() hclog.Level

Returns the current level.

func (HashicorpLoggerWrapper) ImpliedArgs

func (logger HashicorpLoggerWrapper) ImpliedArgs() []interface{}

ImpliedArgs returns With key/value pairs.

func (HashicorpLoggerWrapper) Info

func (logger HashicorpLoggerWrapper) Info(msg string, args ...interface{})

Emit a message and key/value pairs at the INFO level.

func (HashicorpLoggerWrapper) IsDebug

func (logger HashicorpLoggerWrapper) IsDebug() bool

Indicate if DEBUG logs would be emitted. This and the other Is* guards.

func (HashicorpLoggerWrapper) IsError

func (logger HashicorpLoggerWrapper) IsError() bool

Indicate if ERROR logs would be emitted. This and the other Is* guards.

func (HashicorpLoggerWrapper) IsInfo

func (logger HashicorpLoggerWrapper) IsInfo() bool

Indicate if INFO logs would be emitted. This and the other Is* guards.

func (HashicorpLoggerWrapper) IsTrace

func (logger HashicorpLoggerWrapper) IsTrace() bool

Indicate if TRACE logs would be emitted. This and the other Is* guards are used to elide expensive logging code based on the current level.

func (HashicorpLoggerWrapper) IsWarn

func (logger HashicorpLoggerWrapper) IsWarn() bool

Indicate if WARN logs would be emitted. This and the other Is* guards.

func (HashicorpLoggerWrapper) Log

func (logger HashicorpLoggerWrapper) Log(level hclog.Level, msg string, args ...interface{})

Args are alternating key, val pairs keys must be strings vals can be any type, but display is implementation specific Emit a message and key/value pairs at a provided log level.

func (HashicorpLoggerWrapper) Name

func (logger HashicorpLoggerWrapper) Name() string

Returns the Name of the logger.

func (HashicorpLoggerWrapper) Named

func (logger HashicorpLoggerWrapper) Named(string) hclog.Logger

Create a logger that will prepend the name string on the front of all messages. If the logger already has a name, the new value will be appended to the current name. That way, a major subsystem can use this to decorate all it's own logs without losing context.

func (HashicorpLoggerWrapper) ResetNamed

func (logger HashicorpLoggerWrapper) ResetNamed(string) hclog.Logger

Create a logger that will prepend the name string on the front of all messages. This sets the name of the logger to the value directly, unlike Named which honor the current name as well.

func (HashicorpLoggerWrapper) SetLevel

func (logger HashicorpLoggerWrapper) SetLevel(hclog.Level)

Updates the level. This should affect all related loggers as well, unless they were created with IndependentLevels. If an implementation cannot update the level on the fly, it should no-op.

func (HashicorpLoggerWrapper) StandardLogger

func (logger HashicorpLoggerWrapper) StandardLogger(opts *hclog.StandardLoggerOptions) *log.Logger

Return a value that conforms to the stdlib log.Logger interface.

func (HashicorpLoggerWrapper) StandardWriter

func (logger HashicorpLoggerWrapper) StandardWriter(*hclog.StandardLoggerOptions) io.Writer

Return a value that conforms to io.Writer, which can be passed into log.SetOutput(). NOTE: this is only used by gldap package to pretty print LDAP packets. For this purpose, we will log messages only if the current level is lower than Trace.

func (HashicorpLoggerWrapper) Trace

func (logger HashicorpLoggerWrapper) Trace(msg string, args ...interface{})

Emit a message and key/value pairs at the TRACE level.

func (HashicorpLoggerWrapper) Warn

func (logger HashicorpLoggerWrapper) Warn(msg string, args ...interface{})

Emit a message and key/value pairs at the WARN level.

func (HashicorpLoggerWrapper) With

func (logger HashicorpLoggerWrapper) With(args ...interface{}) hclog.Logger

Creates a sublogger that will always have the given key/value pairs.

type HashicorpLoggerWriter

type HashicorpLoggerWriter struct {
	// contains filtered or unexported fields
}

func (*HashicorpLoggerWriter) Write

func (writer *HashicorpLoggerWriter) Write(p []byte) (n int, err error)

Write implements io.Writer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL