Documentation ¶
Overview ¶
Package log is a log package used by onex project.
Index ¶
- func Debugf(format string, args ...interface{})
- func Debugw(msg string, keyvals ...interface{})
- func Errorf(format string, args ...interface{})
- func Errorw(err error, msg string, keyvals ...interface{})
- func Fatalf(format string, args ...interface{})
- func Fatalw(msg string, keyvals ...interface{})
- func Infof(format string, args ...interface{})
- func Infow(msg string, keyvals ...interface{})
- func Init(opts *Options)
- func NewLogger(opts *Options) *zapLogger
- func Panicf(format string, args ...interface{})
- func Panicw(msg string, keyvals ...interface{})
- func Sync()
- func Warnf(format string, args ...interface{})
- func Warnw(msg string, keyvals ...interface{})
- func WithContext(ctx context.Context, keyvals ...interface{}) context.Context
- type Field
- type KratosLogger
- type Logger
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type KratosLogger ¶
type Logger ¶
type Logger interface { Debugf(format string, args ...interface{}) Debugw(msg string, keyvals ...interface{}) Infof(format string, args ...interface{}) Infow(msg string, keyvals ...interface{}) Warnf(format string, args ...interface{}) Warnw(msg string, keyvals ...interface{}) Errorf(format string, args ...interface{}) Errorw(err error, msg string, keyvals ...interface{}) Panicf(format string, args ...interface{}) Panicw(msg string, keyvals ...interface{}) Fatalf(format string, args ...interface{}) Fatalw(msg string, keyvals ...interface{}) With(fields ...Field) Logger AddCallerSkip(skip int) Logger Sync() // integrate other loggers krtlog.Logger gormlogger.Interface }
Logger 定义了 onex 项目的日志接口. 该接口只包含了支持的日志记录方法.
func AddCallerSkip ¶
func FromContext ¶
FromContext returns a logger with predefined values from a context.Context.
type Options ¶
type Options struct { // DisableCaller specifies whether to include caller information in the log. DisableCaller bool `json:"disable-caller,omitempty" mapstructure:"disable-caller"` // DisableStacktrace specifies whether to record a stack trace for all messages at or above panic level. DisableStacktrace bool `json:"disable-stacktrace,omitempty" mapstructure:"disable-stacktrace"` // EnableColor specifies whether to output colored logs. EnableColor bool `json:"enable-color" mapstructure:"enable-color"` // Level specifies the minimum log level. Valid values are: debug, info, warn, error, dpanic, panic, and fatal. Level string `json:"level,omitempty" mapstructure:"level"` // Format specifies the log output format. Valid values are: console and json. Format string `json:"format,omitempty" mapstructure:"format"` // OutputPaths specifies the output paths for the logs. OutputPaths []string `json:"output-paths,omitempty" mapstructure:"output-paths"` }
Options contains configuration options for logging.
func NewOptions ¶
func NewOptions() *Options
NewOptions creates a new Options object with default values.
Click to show internal directories.
Click to hide internal directories.