base

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GinRecover

func GinRecover(c *gin.Context, param interface{})

GinRecover define

func SetLogger

func SetLogger(log ILogger)

SetLogger is set for logger instance

Types

type FileHook

type FileHook struct {
	LogFolderPath string
}

FileHook is a hook for writing log in local file

func NewFileHook

func NewFileHook(logFolderPath string) *FileHook

NewFileHook is an new method for new a file hook

func (*FileHook) Fire

func (hook *FileHook) Fire(entry *logrus.Entry) error

Fire is the method must defined in hook

func (*FileHook) GetLogFilePath

func (hook *FileHook) GetLogFilePath(level logrus.Level) string

GetLogFilePath is a func to get log file path

func (*FileHook) Levels

func (hook *FileHook) Levels() []logrus.Level

Levels is the method must defined in hook

type ILogger

type ILogger interface {
	// WriteError is for error record
	WriteError(err interface{}, trace string, param interface{})

	// WriteInfo is for temp debug info
	WriteInfo(param interface{})
}

ILogger define the log actions

var Logger ILogger

type LogrusLogger

type LogrusLogger struct {
}

func NewLogrusLogger

func NewLogrusLogger(logPath string) (*LogrusLogger, error)

NewLogrusLogger is init func for an new instance

func (*LogrusLogger) WriteError

func (logger *LogrusLogger) WriteError(err interface{}, trace string, param interface{})

WriteError for error info

func (*LogrusLogger) WriteInfo

func (logger *LogrusLogger) WriteInfo(param interface{})

WriteInfo for temp debug info

Jump to

Keyboard shortcuts

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