README ¶
logrus
logrus logger implementation for go-admin meta logger.
Usage
import (
"os"
"github.com/sirupsen/logrus"
"github.com/go-admin-team/go-admin-core/logger"
)
func ExampleWithOutput() {
logger.DefaultLogger = NewLogger(logger.WithOutput(os.Stdout))
logger.Infof("testing: %s", "Infof")
}
func ExampleWithLogger() {
l := logrus.New() // *logrus.Logger
logger.DefaultLogger = NewLogger(WithLogger(l))
logger.Infof("testing: %s", "Infof")
}
Documentation ¶
Index ¶
- func NewLogger(opts ...logger.Option) logger.Logger
- func ReportCaller() logger.Option
- func WithExitFunc(exit func(int)) logger.Option
- func WithJSONFormatter(formatter *logrus.JSONFormatter) logger.Option
- func WithLevelHooks(hooks logrus.LevelHooks) logger.Option
- func WithLogger(l logrus.StdLogger) logger.Option
- func WithTextTextFormatter(formatter *logrus.TextFormatter) logger.Option
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReportCaller ¶
warning to use this option. because logrus doest not open CallerDepth option this will only print this package
func WithExitFunc ¶
func WithJSONFormatter ¶
func WithJSONFormatter(formatter *logrus.JSONFormatter) logger.Option
func WithLevelHooks ¶
func WithLevelHooks(hooks logrus.LevelHooks) logger.Option
func WithTextTextFormatter ¶
func WithTextTextFormatter(formatter *logrus.TextFormatter) logger.Option
Types ¶
Click to show internal directories.
Click to hide internal directories.