Documentation ¶
Overview ¶
Package logger is a package that provides a logger interface and an adapter for the slog package.
Index ¶
- type Adapter
- func (l *Adapter) Debug(entry logjuice.GoogleLogEntry)
- func (l *Adapter) Error(entry logjuice.GoogleLogEntry)
- func (l *Adapter) Info(entry logjuice.GoogleLogEntry)
- func (l *Adapter) JSONLog(ctx context.Context, level logjuice.LogLevel, data interface{}, emoji string, ...)
- func (l *Adapter) Log(ctx context.Context, level logjuice.LogLevel, message, component string)
- func (l *Adapter) SLog(ctx context.Context, level logjuice.LogLevel, emoji string, message ...string)
- func (l *Adapter) Warn(entry logjuice.GoogleLogEntry)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
func (*Adapter) Debug ¶
func (l *Adapter) Debug(entry logjuice.GoogleLogEntry)
Debug logs a debug message.
func (*Adapter) Error ¶
func (l *Adapter) Error(entry logjuice.GoogleLogEntry)
Error logs an error message.
func (*Adapter) Info ¶
func (l *Adapter) Info(entry logjuice.GoogleLogEntry)
Info logs an info message.
func (*Adapter) JSONLog ¶ added in v1.14.6
func (l *Adapter) JSONLog(ctx context.Context, level logjuice.LogLevel, data interface{}, emoji string, message ...string)
JSONLog logs a structured message with the specified level, emoji & messages, in a structured way following Google Cloud's logging guidelines.
The data parameter is expected to be a struct or map that can be marshaled into JSON.
Message field will be populated with the indent JSON string of the data.
If the data is nil, the message field will be populated with a message indicating that the data is nil.
If the data cannot be indented into a JSON string, the message field will be populated with a message indicating that the data could not be indented.
Trace is retrieved from the context using the logger's trace key.
func (*Adapter) SLog ¶ added in v1.14.6
func (l *Adapter) SLog(ctx context.Context, level logjuice.LogLevel, emoji string, message ...string)
SLog logs a structured message with the specified level, emoji & messages, in a structured way following Google Cloud's logging guidelines.
Trace is retrieved from the context using the logger's trace key.
func (*Adapter) Warn ¶
func (l *Adapter) Warn(entry logjuice.GoogleLogEntry)
Warn logs a warning message.