wla

package module
v0.0.0-...-0856b29 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2022 License: MIT Imports: 2 Imported by: 1

README

Watermill Logrus Adapter

An adapter for using watermill with logrus logger.


Installation

go get github.com/ma-hartma/watermill-logrus-adapter

Use LogrusLoggerAdapter

package main

import (
    wla "github.com/ma-hartma/watermill-logrus-adapter"
	"github.com/sirupsen/logrus"
)

func main() {
    // create a logrus logger instance
    log := logrus.New()

    // pass the logrus logger instance to NewLogrusLogger
    // to get your LoggerAdapter
    var logger watermill.LoggerAdapter
    logger = wla.NewLogrusLogger(log)

    // you can now use the logger with watermill
    ...
}

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogrusLogger

func NewLogrusLogger(log *logrus.Logger) watermill.LoggerAdapter

NewLogrusLogger returns a LogrusLoggerAdapter that sends all logs to the passed logrus instance.

Types

type LogrusLoggerAdapter

type LogrusLoggerAdapter struct {
	// contains filtered or unexported fields
}

LogrusLoggerAdapter is a watermill logger adapter for logrus.

func (*LogrusLoggerAdapter) Debug

func (l *LogrusLoggerAdapter) Debug(msg string, fields watermill.LogFields)

Debug logs on level debug with optional fields.

func (*LogrusLoggerAdapter) Error

func (l *LogrusLoggerAdapter) Error(msg string, err error, fields watermill.LogFields)

Error logs on level error with err as field and optional fields.

func (*LogrusLoggerAdapter) Info

func (l *LogrusLoggerAdapter) Info(msg string, fields watermill.LogFields)

Info logs on level info with optional fields.

func (*LogrusLoggerAdapter) Trace

func (l *LogrusLoggerAdapter) Trace(msg string, fields watermill.LogFields)

Trace logs on level trace with optional fields.

func (*LogrusLoggerAdapter) With

With returns a new LogrusLoggerAdapter that includes fields to be re-used between logging statements.

Jump to

Keyboard shortcuts

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