Documentation
¶
Index ¶
- Constants
- func Debug(msg string, fields ...zap.Field)
- func DebugCtx(ctx context.Context, msg string, fields ...zap.Field)
- func Error(msg string, err error, fields ...zap.Field)
- func ErrorCtx(ctx context.Context, msg string, err error, fields ...zap.Field)
- func Fatal(msg string, fields ...zap.Field)
- func FatalCtx(ctx context.Context, msg string, fields ...zap.Field)
- func Info(msg string, fields ...zap.Field)
- func InfoCtx(ctx context.Context, msg string, fields ...zap.Field)
- func Init(opts ...Option) error
- func InitDevelopment() error
- func InitProduction() error
- func Sync() error
- func Trace(ctx context.Context, funcName string) func()
- func Warn(msg string, fields ...zap.Field)
- func WarnCtx(ctx context.Context, msg string, fields ...zap.Field)
- type Logger
- func (l *Logger) Debug(msg string, fields ...zap.Field)
- func (l *Logger) DebugCtx(ctx context.Context, msg string, fields ...zap.Field)
- func (l *Logger) Error(msg string, err error, fields ...zap.Field)
- func (l *Logger) ErrorCtx(ctx context.Context, msg string, err error, fields ...zap.Field)
- func (l *Logger) Fatal(msg string, fields ...zap.Field)
- func (l *Logger) FatalCtx(ctx context.Context, msg string, fields ...zap.Field)
- func (l *Logger) Info(msg string, fields ...zap.Field)
- func (l *Logger) InfoCtx(ctx context.Context, msg string, fields ...zap.Field)
- func (l *Logger) Sync() error
- func (l *Logger) Trace(ctx context.Context, funcName string) func()
- func (l *Logger) Warn(msg string, fields ...zap.Field)
- func (l *Logger) WarnCtx(ctx context.Context, msg string, fields ...zap.Field)
- func (l *Logger) With(fields ...zap.Field) *Logger
- func (l *Logger) WithContext(ctx context.Context) *Logger
- type Option
- func WithEnv(env string) Option
- func WithLevel(level zapcore.Level) Option
- func WithLogToFile(logToFile bool) Option
- func WithRequestKey(requestKey string) Option
- func WithRotate(rotate bool) Option
- func WithRotateAge(rotateAge int) Option
- func WithRotateBackups(rotateBackups int) Option
- func WithRotateCompress(rotateCompress bool) Option
- func WithRotatePath(rotatePath string) Option
- func WithRotateSize(rotateSize int) Option
- func WithServiceName(serviceName string) Option
- func WithUserKey(userKey string) Option
- func WithVersionName(versionName string) Option
Constants ¶
View Source
const ( Development = "development" Production = "production" RequestKey = "request_id" UserKey = "user_id" ServerName = "rhino_logger" Version = "v1.0.0" )
Variables ¶
This section is empty.
Functions ¶
func InitDevelopment ¶
func InitDevelopment() error
func InitProduction ¶
func InitProduction() error
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func NewDevelopment ¶
func NewProduction ¶
func WithContext ¶
type Option ¶
type Option func(*Logger)
func WithLogToFile ¶ added in v0.0.4
func WithRequestKey ¶
func WithRotate ¶
func WithRotateAge ¶
func WithRotateBackups ¶
func WithRotateCompress ¶
func WithRotatePath ¶
func WithRotateSize ¶
func WithServiceName ¶
func WithUserKey ¶
func WithVersionName ¶
Click to show internal directories.
Click to hide internal directories.