logger

package
v0.0.0-...-fc17aaa Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FORMAT_TEXT   = "text"
	FORMAT_JSON   = "json"
	FORMAT_CUSTOM = "custom"
)
View Source
const FileSuffix = ".log"

Variables

This section is empty.

Functions

func WithLogAppName

func WithLogAppName(appname string) appNameOption

func WithLogDir

func WithLogDir(dir string) dirOption

func WithLogFormatter

func WithLogFormatter(formatter string) formatterOption

func WithLogLevel

func WithLogLevel(level string) levelOption

func WithLogShowLine

func WithLogShowLine(s bool) showLineOption

Types

type GameFormatter

type GameFormatter struct {
	AppName string

	ForceColors bool
	// contains filtered or unexported fields
}

func NewGameFormater

func NewGameFormater(appName string, types GameLogType) *GameFormatter

func (*GameFormatter) AddType

func (m *GameFormatter) AddType(t GameLogType)

func (*GameFormatter) Format

func (m *GameFormatter) Format(entry *logrus.Entry) ([]byte, error)

func (*GameFormatter) RemoveType

func (m *GameFormatter) RemoveType(t GameLogType)

type GameLogType

type GameLogType uint32
const (
	TYPE_REDIS GameLogType = 1 << iota
	TYPE_TCP
	TYPE_ROUTER
	TYPE_CGI
	TYPE_GAME
)
const TYPE_UNKNOW GameLogType = 0

func ParseGameLogType

func ParseGameLogType(s string) GameLogType

type ILoggerOption

type ILoggerOption interface {
	Apply(*Option)
}

type Logger

type Logger struct {
	logrus.Logger
	// contains filtered or unexported fields
}

func New

func New(opts ...ILoggerOption) *Logger

func (*Logger) Flush

func (l *Logger) Flush()

func (*Logger) HackDefaultLogger

func (log *Logger) HackDefaultLogger()

func (*Logger) SetLogDir

func (l *Logger) SetLogDir(logDir string)

func (*Logger) SetLogLevel

func (l *Logger) SetLogLevel(level string)

type LogrusConf

type LogrusConf = Option

type Option

type Option struct {
	AppName   string
	Dir       string
	Level     string
	Formatter string
	ShowLine  bool
}

Jump to

Keyboard shortcuts

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