Documentation ¶
Index ¶
- Constants
- Variables
- func NewWithLogger(logger logrus.FieldLogger) *gormLogger
- func NewWithNameAndLogger(name string, logger logrus.FieldLogger) *gormLogger
- func ParseFunctionName(pc uintptr) (categoryName string, functionName string)
- func SetupLogrusToConsole(log *logrus.Logger)
- func SetupLogrusToFile(log *logrus.Logger, url string)
- type ELKLogrusHook
- type Logger
- type LoggingStrategy
Constants ¶
View Source
const ( ELK_STRATEGY LoggingStrategy = "ELK_STRATEGY" FILE_ELK_STRATEGY = "FILE_ELK_STRATEGY" CONSOLE_STRATEGY = "CONSOLE_STRATEGY" FILE_STRATEGY = "FILE_STRATEGY" )
Variables ¶
View Source
var ( // DefaultLogLevels is the log levels for which errors are reported by Hook, if Hook.LogLevels is not set. DefaultLogLevels = []logrus.Level{ logrus.PanicLevel, logrus.FatalLevel, logrus.ErrorLevel, logrus.WarnLevel, logrus.InfoLevel, logrus.DebugLevel, logrus.TraceLevel, } )
Functions ¶
func NewWithLogger ¶
func NewWithLogger(logger logrus.FieldLogger) *gormLogger
NewWithLogger Create new logger with custom logger
func NewWithNameAndLogger ¶
func NewWithNameAndLogger(name string, logger logrus.FieldLogger) *gormLogger
NewWithNameAndLogger Create new logger with custom name and logger
func ParseFunctionName ¶
func SetupLogrusToConsole ¶
func SetupLogrusToFile ¶
Types ¶
type ELKLogrusHook ¶
type ELKLogrusHook struct { LogLevels []logrus.Level HttpClient *resty.Client Url string Formatter *logrus.JSONFormatter }
func NewELKLogrusHook ¶
func NewELKLogrusHook(Url string) ELKLogrusHook
func (ELKLogrusHook) Fire ¶
func (this ELKLogrusHook) Fire(entry *logrus.Entry) error
Fire reports the log entry as an error to the APM Server.
func (ELKLogrusHook) Levels ¶
func (this ELKLogrusHook) Levels() []logrus.Level
type Logger ¶
type Logger struct { Component string RLog logrus.FieldLogger Strategy LoggingStrategy ElasticUrl string }
type LoggingStrategy ¶
type LoggingStrategy string
Click to show internal directories.
Click to hide internal directories.