Documentation ¶
Index ¶
- type Level
- type LogFormatter
- type Logger
- func (l Logger) Critical(ctx context.Context, err error)
- func (l Logger) Debug(ctx context.Context, msg string, args ...interface{})
- func (l Logger) Error(ctx context.Context, err error)
- func (l Logger) Fatal(ctx context.Context, err error)
- func (l Logger) Info(ctx context.Context, msg string, args ...interface{})
- func (l Logger) JSON(ctx context.Context, data any, logLevel ...Level)
- func (l Logger) Warning(ctx context.Context, msg string, args ...interface{})
- type LoggerParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Level ¶
type Level int
Level indicates the severity of the data being logged.
const ( // LevelCritical alerts about severe problems. Most of the time, needs some human intervention ASAP. LevelCritical Level = iota + 1 // LevelError alerts about events that are likely to cause problems. LevelError // LevelWarning warns about events the might cause problems to the system. LevelWarning // LevelInfo are routine information. LevelInfo // LevelDebug are debug or trace information. LevelDebug )
type LogFormatter ¶ added in v0.2.3
type LogFormatter interface { // Format formats the log payload that will be rendered. Format(context.Context, format.LogInput) any }
LogFormatter defines how structures that formats logs should behavior.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is the structure responsible for log data.
func NewLogger ¶
func NewLogger(params LoggerParams) *Logger
NewLogger constructs a new Logger instance.
func (Logger) Fatal ¶ added in v0.2.1
Fatal logs critical data and exists current program execution.
type LoggerParams ¶
type LoggerParams struct { Level string Formatter LogFormatter Attributes format.LogAttributeSet }
LoggerParams defines the dependencies of a Logger.
Click to show internal directories.
Click to hide internal directories.