Documentation
¶
Index ¶
- Constants
- Variables
- func Configure(cfg Config) error
- func ContextFields(ctx context.Context) []zap.Field
- func Cron(name string) cron.Logger
- func Ctx(ctx context.Context) *zap.Logger
- func Debug(msg string, fields ...zap.Field)
- func Default() *zap.Logger
- func Error(msg string, err error, fields ...zap.Field)
- func Field(ctx context.Context, key string) string
- func From(app *runtime.App) *zap.Logger
- func Info(msg string, fields ...zap.Field)
- func Init(name, level, mode string) error
- func Named(name string) *zap.Logger
- func New(name string) (*zap.Logger, error)
- func Sync()
- func Warn(msg string, fields ...zap.Field)
- func WithContext(ctx context.Context, log *zap.Logger) *zap.Logger
- func WithField(ctx context.Context, key, value string) context.Context
- func WriteSyncer(name, filename string) (zapcore.WriteSyncer, error)
- func Writer(name, filename string) (io.Writer, error)
- type AsynqLogger
- type Config
- type RotationConfig
Constants ¶
View Source
const ( TrackIDKey = "track_id" TraceIDKey = "trace_id" SpanIDKey = "span_id" RequestIDKey = "request_id" TaskIDKey = "task_id" QueueKey = "queue" TypeKey = "type" RunIDKey = "run_id" JobIDKey = "job_id" )
View Source
const KeyLogger runtime.Key = "logger"
Variables ¶
View Source
var (
L *zap.Logger
)
Functions ¶
func WriteSyncer ¶
func WriteSyncer(name, filename string) (zapcore.WriteSyncer, error)
Types ¶
type AsynqLogger ¶
type AsynqLogger struct {
// contains filtered or unexported fields
}
func Asynq ¶
func Asynq(name string) *AsynqLogger
func (*AsynqLogger) Debug ¶
func (l *AsynqLogger) Debug(args ...interface{})
func (*AsynqLogger) Error ¶
func (l *AsynqLogger) Error(args ...interface{})
func (*AsynqLogger) Fatal ¶
func (l *AsynqLogger) Fatal(args ...interface{})
func (*AsynqLogger) Info ¶
func (l *AsynqLogger) Info(args ...interface{})
func (*AsynqLogger) Warn ¶
func (l *AsynqLogger) Warn(args ...interface{})
type Config ¶
type Config struct {
Name string `mapstructure:"name" yaml:"name"`
Level string `mapstructure:"level" yaml:"level"`
Mode string `mapstructure:"mode" yaml:"mode"`
Format string `mapstructure:"format" yaml:"format"`
RootDir string `mapstructure:"root_dir" yaml:"root_dir"`
Rotation RotationConfig `mapstructure:"rotation" yaml:"rotation"`
}
type RotationConfig ¶
type RotationConfig struct {
Mode string `mapstructure:"mode" yaml:"mode"`
MaxSize int `mapstructure:"max_size" yaml:"max_size"`
MaxBackups int `mapstructure:"max_backups" yaml:"max_backups"`
MaxAge int `mapstructure:"max_age" yaml:"max_age"`
Compress bool `mapstructure:"compress" yaml:"compress"`
}
Click to show internal directories.
Click to hide internal directories.