logrus

package module
v0.0.0-...-57a908f Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(log *logrus.Logger) log.Logger

New create new logrus handler. Deprecated: delete after 0.7.0

Example (LogrusHandler)
package main

import (
	"context"
	"io"
	"os"

	slogrus "github.com/sirupsen/logrus"
	"gitoa.ru/go-4devs/log/field"
	"gitoa.ru/go-4devs/log/handler/logrus"
)

func main() {
	ctx := context.Background()
	lgrs := slogrus.New()
	lgrs.SetOutput(os.Stdout)
	lgrs.SetFormatter(&slogrus.TextFormatter{
		DisableTimestamp: true,
	})

	log := logrus.New(lgrs)
	log.Err(ctx, "log logrus")
	log.ErrKV(ctx, "log logrus kv", field.Int("int", 42))
	log.ErrKVs(ctx, "log logrus kv sugar", "err", io.EOF)

}
Output:

level=error msg="log logrus"
level=error msg="log logrus kv" int=42
level=error msg="log logrus kv sugar" err=EOF

func Standard

func Standard() log.Logger

Standard create new standart logrus handler. Deprecated: delete after 0.7.0

Types

This section is empty.

Jump to

Keyboard shortcuts

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