logrusadapter

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2020 License: BSD-3-Clause Imports: 1 Imported by: 0

README

logrus logger adapter

Usage

import (
    "github.com/clevergo/log"
    "github.com/clevergo/log/logrusadapter"
    "github.com/sirupsen/logrus"
)

var logger log.Logger

func main() {
    logger = logrusadapter.New(logrus.New())
    logger.Debug("debug msg")
    // ...
}

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	*logrus.Logger
}

Logger is a logrus logger adapter that implements logger interface.

func New

func New(logrusLogger *logrus.Logger) *Logger

New returns a logger.

Example
logger := New(logrus.New())
logger.Debug("debug")
logger.Debugf("debugf")
logger.Debugln("debugln")

logger.Info("info")
logger.Infof("infof")
logger.Infoln("infoln")

logger.Warn("warn")
logger.Warnf("warnf")
logger.Warnln("warnln")

logger.Error("error")
logger.Errorf("errorf")
logger.Errorln("errorln")

//logger.Fatal("fatal")
//logger.Fatalf("fatalf")
//logger.Fatalln("fatalln")
Output:

Jump to

Keyboard shortcuts

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