Documentation
¶
Index ¶
- type Config
- type ConsoleTransport
- type LogEntry
- type Logger
- func (lg *Logger) Close() error
- func (lg *Logger) Config() Config
- func (lg *Logger) DPanic(msg string, fields ...zapcore.Field)
- func (lg *Logger) Debug(msg string, fields ...zapcore.Field)
- func (lg *Logger) DroppedCount() int64
- func (lg *Logger) Error(msg string, fields ...zapcore.Field)
- func (lg *Logger) Fatal(msg string, fields ...zapcore.Field)
- func (lg *Logger) Info(msg string, fields ...zapcore.Field)
- func (lg *Logger) Level() zapcore.Level
- func (lg *Logger) Log(lvl zapcore.Level, msg string, fields ...zapcore.Field)
- func (lg *Logger) Panic(msg string, fields ...zapcore.Field)
- func (lg *Logger) Warn(msg string, fields ...zapcore.Field)
- func (lg *Logger) With(fields ...zap.Field) *Logger
- type NOOPTransport
- type State
- type Transport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
Config is the internal config for setup for the logger.
type ConsoleTransport ¶
type ConsoleTransport struct{}
func (*ConsoleTransport) Send ¶
func (t *ConsoleTransport) Send(entry LogEntry) error
type LogEntry ¶
type LogEntry struct {
Level zapcore.Level
Time time.Time
LoggerName string
Message string
Caller zapcore.EntryCaller
Stack string
Fields map[string]any
Service string
InstanceID string
State string
}
func (*LogEntry) MarshalFields ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
A Logger provides fast, leveled, structured logging. All methods are safe for concurrent use. The Logger extends the zap.Logger with the ability to send all logs to a sing
func (*Logger) Close ¶
Close syncs and flushes any buffered log entries while also closing all log workers.
func (*Logger) DPanic ¶
DPanic logs a message at DPanicLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
If the logger is in development mode, it then panics (DPanic means "development panic"). This is useful for catching errors that are recoverable, but shouldn't ever happen.
func (*Logger) Debug ¶
Debug logs a message at DebugLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
func (*Logger) DroppedCount ¶
DroppedCount returns the amount of log entries that were not sent with the transport
func (*Logger) Error ¶
Error logs a message at ErrorLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
func (*Logger) Fatal ¶
Fatal logs a message at FatalLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
The logger then calls os.Exit(1), even if logging at FatalLevel is disabled.
func (*Logger) Info ¶
Info logs a message at InfoLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
func (*Logger) Level ¶
Level reports the minimum enabled level for this logger.
For NopLoggers, this is zapcore.InvalidLevel.
func (*Logger) Log ¶
Log logs a message at the specified level. The message includes any fields passed at the log site, as well as any fields accumulated on the logger. Any Fields that require evaluation (such as Objects) are evaluated upon invocation of Log.
func (*Logger) Panic ¶
Panic logs a message at PanicLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
The logger then panics, even if logging at PanicLevel is disabled.
type NOOPTransport ¶
type NOOPTransport struct{}
func (*NOOPTransport) Send ¶
func (t *NOOPTransport) Send(_ LogEntry) error