logger

package
v0.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2020 License: Apache-2.0 Imports: 7 Imported by: 1

README

logger

Demo

package main

import (
    "github.com/axolotlteam/thunder/logger"
)


func init () {

    logger.NewLogrus()
    logger.SetLevel(logger.DebugLevel)
    logger.SetServiceInfo("thunder")

}

func main() {

    logger.WithFields(logger.Fields{
        "msg" : "xxxxx",
    }).Info("this a test log")
}


{"fields.msg":"xxxxx","file":"log_test.go:13","func":"github.com/axolotlteam/thunder/logger.Test_Logrus()","hostname":"thunder","level":"info","msg":"this is a test log","service":"thunder","time":"2019-09-22T01:23:54+08:00"}


Documentation

Index

Constants

View Source
const (
	TraceLevel = logrus.TraceLevel
	DebugLevel = logrus.DebugLevel
	InfoLevel  = logrus.InfoLevel
	ErrorLevel = logrus.ErrorLevel
	WarnLevel  = logrus.WarnLevel
	FatalLevel = logrus.FatalLevel
	PainLevel  = logrus.PanicLevel
)

log level

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

Debug -

func Debugf added in v0.10.0

func Debugf(format string, args ...interface{})

Debugf -

func Error

func Error(args ...interface{})

Error -

func Errorf added in v0.10.0

func Errorf(format string, args ...interface{})

Errorf -

func Fatal

func Fatal(args ...interface{})

Fatal -

func Fatalf added in v0.10.0

func Fatalf(format string, args ...interface{})

Fatalf - format logger with fatal

func Info

func Info(args ...interface{})

Info -

func Infof added in v0.10.0

func Infof(format string, args ...interface{})

Infof -

func Logrus added in v0.4.1

func Logrus() *logrus.Logger

Logrus -

func NewLogrus

func NewLogrus()

NewLogrus -

func Panic

func Panic(args ...interface{})

Panic -

func Panicf added in v0.10.0

func Panicf(format string, args ...interface{})

Panicf -

func SetLevel

func SetLevel(level logrus.Level)

SetLevel -

func SetServiceInfo added in v0.1.1

func SetServiceInfo(service string)

SetServiceInfo -

func SetSlackHook added in v0.1.1

func SetSlackHook(webhook string, level logrus.Level)

SetSlackHook -

func Trace

func Trace(args ...interface{})

Trace -

func Tracef added in v0.10.0

func Tracef(format string, args ...interface{})

Tracef -

func Warn

func Warn(args ...interface{})

Warn -

func Warnf added in v0.10.0

func Warnf(format string, args ...interface{})

Warnf -

func WithContext added in v0.1.1

func WithContext(ctx context.Context) *logrus.Entry

WithContext -

func WithError added in v0.1.1

func WithError(err error) *logrus.Entry

WithError -

func WithField added in v0.1.1

func WithField(key string, value interface{}) *logrus.Entry

WithField -

func WithFields

func WithFields(f Fields) *logrus.Entry

WithFields -

func Writer added in v0.1.1

func Writer() *io.PipeWriter

Writer -

Types

type Fields

type Fields = logrus.Fields

Fields -

type Level added in v0.11.0

type Level = logrus.Level

Level -

type Logger added in v0.10.0

type Logger interface {
	Fatal(args ...interface{})
	Warn(args ...interface{})
	Info(args ...interface{})
	Error(args ...interface{})
	Fatalf(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Errorf(format string, args ...interface{})
}

Logger -

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL