Documentation
¶
Index ¶
- type Logger
- func (l *Logger) Close() error
- func (l *Logger) Debug() *zerolog.Event
- func (l *Logger) Error() *zerolog.Event
- func (l *Logger) Fatal() *zerolog.Event
- func (l *Logger) Info() *zerolog.Event
- func (l *Logger) LogFilePath() string
- func (l *Logger) Warn() *zerolog.Event
- func (l *Logger) With(keyvals ...interface{}) *Logger
- func (l *Logger) Zerolog() zerolog.Logger
- type Options
- type OtelOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶ added in v0.3.2
type Logger struct {
// contains filtered or unexported fields
}
Logger wraps zerolog with file rotation and optional OTEL export. Create with New or Nop. Safe for concurrent use after construction.
func New ¶ added in v0.3.2
New creates a logger with file output and optional OTEL bridge.
OTEL failure is non-fatal: the logger falls back to file-only and the OTEL warning is written to the log file.
func (*Logger) Close ¶ added in v0.3.2
Close flushes pending OTEL batches and closes the file writer. Safe to call multiple times. Safe to call on a Nop logger.
func (*Logger) Fatal ¶ added in v0.3.2
Fatal logs at fatal level and exits. Avoid in Cobra hooks — return errors instead.
func (*Logger) LogFilePath ¶ added in v0.3.2
LogFilePath returns the path to the current log file, or empty string if this is a nop logger.
type Options ¶ added in v0.1.6
type Options struct {
// LogsDir is the directory for log files. Required for file logging.
LogsDir string
// Filename overrides the log file name within LogsDir.
// Defaults to "clawker.log" when empty.
Filename string
// File rotation settings.
MaxSizeMB int // default: 50
MaxAgeDays int // default: 7
MaxBackups int // default: 3
Compress bool // default: true
// Otel configures the OTEL zerolog bridge. Nil disables OTEL export.
Otel *OtelOptions
}
Options configures the logger.
type OtelOptions ¶ added in v0.3.2
type OtelOptions struct {
Endpoint string // e.g. "localhost:4318"
Insecure bool // default: true (local collector)
Timeout time.Duration // export timeout
MaxQueueSize int // batch processor queue size
ExportInterval time.Duration // batch export interval
}
OtelOptions configures the OTLP HTTP log exporter.