Documentation
¶
Index ¶
Constants ¶
const ( RuntimeLogAppenderZapRollingFile = "zap_rolling_file" RuntimeEnvLogChannelRecord = "record" RuntimeSuccessCommandOutputPolicy = "suppressed" RuntimeFailureCommandOutputPolicy = "included" RuntimeVerboseCommandOutputPolicy = "details_on_verbose" RuntimeRecordCommandDiagnosticsMode = "preserved" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Logger ¶
type Logger interface {
Debug(msg string, keysAndValues ...any)
Info(msg string, keysAndValues ...any)
Warn(msg string, keysAndValues ...any)
Error(msg string, keysAndValues ...any)
Verbose(msg string, keysAndValues ...any)
}
Logger is the logging interface accepted by the factory.
func EnsureLogger ¶
EnsureLogger returns l if non-nil, otherwise returns a NoopLogger.
type NoopLogger ¶
type NoopLogger struct{}
NoopLogger is a Logger that discards all log output. Used as the default when no logger is provided.
func (NoopLogger) Debug ¶
func (NoopLogger) Debug(_ string, _ ...any)
func (NoopLogger) Error ¶
func (NoopLogger) Error(_ string, _ ...any)
func (NoopLogger) Info ¶
func (NoopLogger) Info(_ string, _ ...any)
func (NoopLogger) Verbose ¶
func (NoopLogger) Verbose(_ string, _ ...any)
func (NoopLogger) Warn ¶
func (NoopLogger) Warn(_ string, _ ...any)
type RuntimeLogConfig ¶
type RuntimeLogConfig struct {
// MaxSize sets the maximum size in megabytes of a log file before rotate.
MaxSize int
// MaxBackups controls how many backup files are retained.
MaxBackups int
// MaxAge controls how many days to retain backup files.
MaxAge int
// Compress enables gzip compression for rotated log files.
Compress bool
}
RuntimeLogConfig controls rolling-file policy for the runtime logger. Values are in megabytes (MaxSize) and days (MaxAge).
func DefaultRuntimeLogConfig ¶
func DefaultRuntimeLogConfig() RuntimeLogConfig
DefaultRuntimeLogConfig returns the production rolling-file policy used when callers do not set explicit runtime log limits.
type RuntimeLogSink ¶
type RuntimeLogSink struct {
// contains filtered or unexported fields
}
RuntimeLogSink owns the file-backed runtime logger and its rolling writer.
func BuildRuntimeLogger ¶
func BuildRuntimeLogger(base *zap.Logger, runtimeInstanceID, runtimeLogDir string, config RuntimeLogConfig) (*RuntimeLogSink, error)
BuildRuntimeLogger creates a zap logger that writes runtime records to a bounded rolling JSON log file.
func (*RuntimeLogSink) Close ¶
func (s *RuntimeLogSink) Close() error
Close releases the runtime log writer.
func (*RuntimeLogSink) Config ¶
func (s *RuntimeLogSink) Config() RuntimeLogConfig
Config returns the normalized rolling-file policy applied to the sink.
func (*RuntimeLogSink) Logger ¶
func (s *RuntimeLogSink) Logger() *zap.Logger
Logger returns the zap logger enriched with runtime logging fields and the rolling file core.
func (*RuntimeLogSink) Path ¶
func (s *RuntimeLogSink) Path() string
Path returns the active runtime log path.
func (*RuntimeLogSink) RootDir ¶ added in v0.0.5
func (s *RuntimeLogSink) RootDir() string
RootDir returns the runtime log root selected by caller configuration or the default home-directory policy.
func (*RuntimeLogSink) StartTimeUTC ¶ added in v0.0.5
func (s *RuntimeLogSink) StartTimeUTC() time.Time
StartTimeUTC returns the UTC timestamp used to organize the active log path.