slf4go_logrus

package module
Version: v0.0.0-...-2778579 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: LGPL-3.0-or-later Imports: 2 Imported by: 0

README

package: github.com/mikelue/go-misc/slf4go-logrus

This packages contains driver of slf4go with "named logger" by logrus.

Usage

Besides UseLogrus.Default(), you can customized your logger with specific name.

UseLogrus.WithConfig(LogrousConfig{
    DEFAULT_LOGGER: yourDefaultLogger,
    "log.name.1": yourLogger1,
    "log.name.2": yourLogger2,
})

Documentation

Overview

This package contains driver(base on logrus) for usage of "slf4go".

slf4go - https://github.com/go-eden/slf4go

logrus - https://github.com/sirupsen/logrus

Use driver

You can use "UseLogrus.xxx()" to register the driver to "slf4go"

UseLogrus.Default()

Customized loggers

You can constructs your own "*logrus.Logger" with named mapping.

UseLogrus.WithConfig(LogrousConfig{
  DEFAULT_LOGGER: yourDefaultLogger,
  "log.name.1": yourLogger1,
  "log.name.2": yourLogger2,
})

Default level

The default level is "slf4go.InfoLevel".

Index

Constants

View Source
const DEFAULT_LOGGER = "<DEFAULT>"

Name of default logger

Variables

This section is empty.

Functions

This section is empty.

Types

type IUseLogrus

type IUseLogrus int
const UseLogrus IUseLogrus = 0

Method space to use logrus as driver of slf4go

func (IUseLogrus) Default

func (self IUseLogrus) Default()

Constructs default setting

Log level of default logger: "slf4go.InfoLevel"

func (IUseLogrus) WithConfig

func (IUseLogrus) WithConfig(config LogrousConfig)

type LogrousConfig

type LogrousConfig map[string]*lr.Logger

Configurations for logrous, which maps name to an instance of "*logrus.Logger"

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL