Documentation ¶
Index ¶
- Constants
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Debugln(args ...interface{})
- func EnableFnTrace()
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Errorln(args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Fatalln(args ...interface{})
- func GetLevel() string
- func GetLogger(ctx context.Context, pkg, fnName string) *logrus.Entry
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func Infoln(args ...interface{})
- func LogInit()
- func MarshalStack(err error) interface{}
- func New(serviceName, serviceVersion string) *logrus.Entry
- func Print(args ...interface{})
- func Printf(format string, args ...interface{})
- func Println(args ...interface{})
- func Request(next http.Handler) http.Handler
- func SetFormatter(formatter logrus.Formatter)
- func SetLevel(level string)
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- func Warnln(args ...interface{})
- func WithContext(ctx context.Context) *logrus.Entry
- func WithErrorContext(ctx context.Context, err error) *logrus.Entry
- func WithFields(fields Fields) *logrus.Entry
- func WithRequest(ctx context.Context, req *http.Request) context.Context
- func WithStack(err error) *logrus.Entry
- type Fields
- type WriterHook
Constants ¶
View Source
const ( SourceFileName = "file" SourceLineName = "name" SourceFuncName = "func" )
Variables ¶
This section is empty.
Functions ¶
func EnableFnTrace ¶
func EnableFnTrace()
func MarshalStack ¶
func MarshalStack(err error) interface{}
func New ¶
New create logger instance with request_id as a field also set the default format to JSON.
func SetFormatter ¶
func WithFields ¶
Types ¶
type WriterHook ¶
WriterHook is a hook that writes logs of specified LogLevels to specified Writer
func (*WriterHook) Fire ¶
func (hook *WriterHook) Fire(entry *logrus.Entry) error
Fire will be called when some logging function is called with current hook It will format log entry to string and write it to appropriate writer
func (*WriterHook) Levels ¶
func (hook *WriterHook) Levels() []logrus.Level
Levels define on which log levels this hook would trigger
Click to show internal directories.
Click to hide internal directories.