Documentation ¶
Index ¶
- Variables
- func Debug(message string, params ...interface{})
- func DebugWithContext(ctx context.Context, message string, params ...interface{})
- func DefaultMessageProducer(ctx context.Context, format string, level Level, code codes.Code, err error, ...)
- func DurationToTimeMillisField(duration time.Duration) (key string, value interface{})
- func Error(err error, message string, params ...interface{})
- func ErrorWithContext(ctx context.Context, err error, message string, params ...interface{})
- func Fatal(err error, message string, params ...interface{})
- func FatalWithContext(ctx context.Context, err error, message string, params ...interface{})
- func Info(message string, params ...interface{})
- func InfoWithContext(ctx context.Context, message string, params ...interface{})
- func Panic(err error, message string, params ...interface{})
- func PanicWithContext(ctx context.Context, err error, message string, params ...interface{})
- func SetLevel(level Level)
- func StreamServerInterceptor(log Logger) grpc.StreamServerInterceptor
- func ToContext(ctx context.Context, log Logger) context.Context
- func Trace(message string, params ...interface{})
- func TraceWithContext(ctx context.Context, message string, params ...interface{})
- func UnaryServerInterceptor(log Logger) grpc.UnaryServerInterceptor
- func Warning(message string, params ...interface{})
- func WarningWithContext(ctx context.Context, message string, params ...interface{})
- type Hook
- type Level
- type Logger
- type Option
- type ReportCaller
- type ReportFormat
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SystemField = "system" KindField = "span.kind" )
View Source
var ( DefaultDurationToField = DurationToTimeMillisField TimestampFormat = utils.TimeFormat )
Functions ¶
func DebugWithContext ¶
func DefaultMessageProducer ¶
func ErrorWithContext ¶
func FatalWithContext ¶
func InfoWithContext ¶
func PanicWithContext ¶
func StreamServerInterceptor ¶
func StreamServerInterceptor(log Logger) grpc.StreamServerInterceptor
StreamServerInterceptor returns a new streaming server interceptor that adds logrus.Entry to the context.
func TraceWithContext ¶
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(log Logger) grpc.UnaryServerInterceptor
UnaryServerInterceptor returns a new unary server interceptors that adds logrus.Entry to the context.
func WarningWithContext ¶
Types ¶
type Level ¶
type Level uint32
const ( // PanicLevel level, highest level of severity. Logs and then calls panic with the // message passed to Debug, Info, ... PanicLevel Level = iota // FatalLevel level. Logs and then calls `logger.Exit(1)`. It will exit even if the // logging level is set to Panic. FatalLevel // ErrorLevel level. Logs. Used for errors that should definitely be noted. // Commonly used for hooks to send errors to an error tracking service. ErrorLevel // WarnLevel level. Non-critical entries that deserve eyes. WarnLevel // InfoLevel level. General operational entries about what's going on inside the // application. InfoLevel // DebugLevel level. Usually only enabled when debugging. Very verbose logging. DebugLevel // TraceLevel level. Designates finer-grained informational events than the Debug. TraceLevel )
func DefaultCodeToLevel ¶
DefaultCodeToLevel is the default implementation of gRPC return codes to log levels for server side.
type Logger ¶
type Logger interface { SetLevel(level Level) GetLevel() Level AddParam(key string, value interface{}) Logger SetSkipCaller(skip int) Logger Trace(message string, params ...interface{}) Debug(message string, params ...interface{}) Info(message string, params ...interface{}) Warning(message string, params ...interface{}) Error(err error, message string, params ...interface{}) Fatal(err error, message string, params ...interface{}) Panic(err error, message string, params ...interface{}) TraceWithContext(ctx context.Context, message string, params ...interface{}) DebugWithContext(ctx context.Context, message string, params ...interface{}) InfoWithContext(ctx context.Context, message string, params ...interface{}) WarningWithContext(ctx context.Context, message string, params ...interface{}) ErrorWithContext(ctx context.Context, err error, message string, params ...interface{}) FatalWithContext(ctx context.Context, err error, message string, params ...interface{}) PanicWithContext(ctx context.Context, err error, message string, params ...interface{}) WithSubModule(module string) Logger io.Writer }
func FromContext ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithExitFunc ¶
func WithHookLevels ¶
func WithReportCallerOption ¶
func WithReportCallerOption(reportCaller *ReportCaller) Option
type ReportCaller ¶
type ReportCaller struct { File bool FileFormat ReportFormat Func bool FuncFormat ReportFormat }
type ReportFormat ¶
Click to show internal directories.
Click to hide internal directories.