Documentation ¶
Overview ¶
Package blog is the brokerapi logger BrokerAPI was originally written to use the CloudFoundry Lager logger (https://github.com/cloudfoundry/lager), and it relied on some idiosyncrasies of that logger that are not found in the (subsequently written) Go standard library log/slog logger. This package is a wrapper around log/slog that adds back the idiosyncrasies of lager, minimizes boilerplate code, and keeps the behavior as similar as possible. It also implements the slog.Handler interface so that it can easily be converted into a slog.Logger. This is useful when calling public APIs (such as FailureResponse.ValidatedStatusCode) which take a slog.Logger as an input, and because they are public cannot take a Blog as an input.
Index ¶
- func BindingID(bindingID string) slog.Attr
- func InstanceID(instanceID string) slog.Attr
- type Blog
- func (b Blog) Enabled(context.Context, slog.Level) bool
- func (b Blog) Error(message string, err error, attr ...any)
- func (b Blog) Handle(_ context.Context, record slog.Record) error
- func (b Blog) Info(message string, attr ...any)
- func (b Blog) Session(ctx context.Context, prefix string, attr ...any) Blog
- func (b Blog) With(attr ...any) Blog
- func (b Blog) WithAttrs(attrs []slog.Attr) slog.Handler
- func (b Blog) WithGroup(string) slog.Handler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstanceID ¶
InstanceID creates an attribute from an instance ID
Types ¶
type Blog ¶
type Blog struct {
// contains filtered or unexported fields
}
func (Blog) Error ¶
Error logs an error. It takes an error type as a convenience, which is different to slog.Logger.Error()
func (Blog) Session ¶
Session emulates a Lager logger session. It returns a new logger that will always log the attributes, prefix, and data from the context.