Documentation ¶
Index ¶
- func Command(ctx context.Context, cfg CommandLogger, name string, arg ...string) *exec.Cmd
- func GetLogger(ctx context.Context) *zap.Logger
- func NewLoggerWriter(logger *zap.Logger, level zapcore.Level) io.Writer
- func TimeOffsetFormatter(start time.Time, color bool) zapcore.TimeEncoder
- func WithLogger(ctx context.Context, logger *zap.Logger) context.Context
- type CategoryWriter
- func (c *CategoryWriter) Check(ent zapcore.Entry, ce *zapcore.CheckedEntry) *zapcore.CheckedEntry
- func (c *CategoryWriter) Enabled(lvl zapcore.Level) bool
- func (c *CategoryWriter) Sync() error
- func (c *CategoryWriter) With(fields []zapcore.Field) zapcore.Core
- func (c *CategoryWriter) Write(ent zapcore.Entry, fields []zapcore.Field) error
- type CommandLogger
- type EntryLeveller
- type LogOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLoggerWriter ¶ added in v0.7.0
func TimeOffsetFormatter ¶ added in v0.7.0
func TimeOffsetFormatter(start time.Time, color bool) zapcore.TimeEncoder
TimeOffsetFormatter returns a time encoder that formats the time as an offset from the start time. This is mostly useful for CLI logging not long-standing services as times beyond a few minutes will be less readable.
Types ¶
type CategoryWriter ¶ added in v0.7.0
type CategoryWriter struct { Encoder zapcore.Encoder LogRootPath string // contains filtered or unexported fields }
func NewCategoryWriter ¶ added in v0.7.0
func NewCategoryWriter(enc zapcore.Encoder, logRootPath string) *CategoryWriter
func (*CategoryWriter) Check ¶ added in v0.7.0
func (c *CategoryWriter) Check(ent zapcore.Entry, ce *zapcore.CheckedEntry) *zapcore.CheckedEntry
func (*CategoryWriter) Enabled ¶ added in v0.7.0
func (c *CategoryWriter) Enabled(lvl zapcore.Level) bool
func (*CategoryWriter) Sync ¶ added in v0.7.0
func (c *CategoryWriter) Sync() error
type CommandLogger ¶ added in v0.7.0
type EntryLeveller ¶ added in v0.7.0
EntryLeveller is a zapcore.Core that filters log entries based on the module name similar to Log4j or python's logging module.
func NewEntryLeveller ¶ added in v0.7.0
func (*EntryLeveller) Check ¶ added in v0.7.0
func (el *EntryLeveller) Check(e zapcore.Entry, ce *zapcore.CheckedEntry) *zapcore.CheckedEntry
type LogOpts ¶ added in v0.7.0
type LogOpts struct { Verbose bool Color string CategoryLogsDir string Encoding string DefaultLevels map[string]zapcore.Level }
func (LogOpts) CategoryCore ¶ added in v0.7.0
func (LogOpts) EntryLeveller ¶ added in v0.7.0
Click to show internal directories.
Click to hide internal directories.