Documentation ¶
Index ¶
- Constants
- func HTTPAddLoggerToContextMiddleware() func(next http.Handler) http.Handler
- func NewStructuredLogger(logger Logger, getTraceID func(r *http.Request) string) func(next http.Handler) http.Handler
- func SetLoggerInContext(ctx context.Context, logger Logger) context.Context
- type CorsLogger
- type Logger
- type StructuredLogger
- type StructuredLoggerEntry
- type TracingLogger
Constants ¶
View Source
const LogFileMode = 0666
View Source
const LogTraceIDField = "trace_id"
Variables ¶
This section is empty.
Functions ¶
func HTTPAddLoggerToContextMiddleware ¶
HTTPAddLoggerToContextMiddleware HTTP Middleware that will add request logger to request context.
Types ¶
type CorsLogger ¶
type CorsLogger interface {
Printf(msg string, args ...interface{})
}
type Logger ¶
type Logger interface { Configure(level string, format string, filePath string) error WithField(key string, value interface{}) Logger WithFields(fields map[string]interface{}) Logger WithError(err error) Logger Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Printf(format string, args ...interface{}) Warnf(format string, args ...interface{}) Warningf(format string, args ...interface{}) Errorf(format string, args ...interface{}) Fatalf(format string, args ...interface{}) Panicf(format string, args ...interface{}) Debug(args ...interface{}) Info(args ...interface{}) Print(args ...interface{}) Warn(args ...interface{}) Warning(args ...interface{}) Error(args ...interface{}) Fatal(args ...interface{}) Panic(args ...interface{}) Debugln(args ...interface{}) Infoln(args ...interface{}) Println(args ...interface{}) Warnln(args ...interface{}) Warningln(args ...interface{}) Errorln(args ...interface{}) Fatalln(args ...interface{}) Panicln(args ...interface{}) GetTracingLogger() TracingLogger GetCorsLogger() CorsLogger }
func GetLoggerFromContext ¶
type StructuredLogger ¶
StructuredLogger structured logger.
func (*StructuredLogger) NewLogEntry ¶
func (l *StructuredLogger) NewLogEntry(r *http.Request) middleware.LogEntry
NewLogEntry new log entry.
type StructuredLoggerEntry ¶
type StructuredLoggerEntry struct {
Logger Logger
}
StructuredLoggerEntry Structured logger entry.
func (*StructuredLoggerEntry) Panic ¶
func (l *StructuredLoggerEntry) Panic(v interface{}, stack []byte)
Panic panic log.
type TracingLogger ¶
Click to show internal directories.
Click to hide internal directories.