mylog

package
v0.0.0-...-c280332 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Errorf

func Errorf(format string, v ...interface{})

func Fatalf

func Fatalf(format string, v ...interface{})

func LogChannel

func LogChannel() chan EnhancedLogEntry

返回日志通道,以便我们的 WebSocket 服务端可以监听和广播日志事件

func LogToFile

func LogToFile(level, message string)

独立的文件日志记录函数

func Printf

func Printf(format string, v ...interface{})

func Println

func Println(v ...interface{})

func SetEnableFileLog

func SetEnableFileLog(value bool)

SetEnableFileLog 设置 enableFileLogGlobal 的值

func WsHandlerWithDependencies

func WsHandlerWithDependencies(c *gin.Context)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

type EnhancedLogEntry

type EnhancedLogEntry struct {
	Time    string `json:"time"`
	Level   string `json:"level"`
	Message string `json:"message"`
}

type LogLevel

type LogLevel int
const (
	LogLevelDebug LogLevel = iota
	LogLevelInfo
	LogLevelWarn
	LogLevelError
)

func GetLogLevelFromConfig

func GetLogLevelFromConfig(logLevel int) LogLevel

type MyLogAdapter

type MyLogAdapter struct {
	Level         LogLevel
	EnableFileLog bool
	FileLogPath   string
}

func NewMyLogAdapter

func NewMyLogAdapter(level LogLevel, enableFileLog bool) *MyLogAdapter

接收新参数,并设置文件日志路径

func (*MyLogAdapter) Debug

func (adapter *MyLogAdapter) Debug(v ...interface{})

Debug logs a message at the debug level.

func (*MyLogAdapter) Debugf

func (adapter *MyLogAdapter) Debugf(format string, v ...interface{})

Debugf logs a formatted message at the debug level.

func (*MyLogAdapter) Error

func (adapter *MyLogAdapter) Error(v ...interface{})

Error logs a message at the error level.

func (*MyLogAdapter) Errorf

func (adapter *MyLogAdapter) Errorf(format string, v ...interface{})

Errorf logs a formatted message at the error level.

func (*MyLogAdapter) Info

func (adapter *MyLogAdapter) Info(v ...interface{})

Info logs a message at the info level.

func (*MyLogAdapter) Infof

func (adapter *MyLogAdapter) Infof(format string, v ...interface{})

Infof logs a formatted message at the info level.

func (*MyLogAdapter) Sync

func (adapter *MyLogAdapter) Sync() error

Sync 实现 Botgo SDK 的 Sync 方法

func (*MyLogAdapter) Warn

func (adapter *MyLogAdapter) Warn(v ...interface{})

Warn logs a message at the warn level.

func (*MyLogAdapter) Warnf

func (adapter *MyLogAdapter) Warnf(format string, v ...interface{})

Warnf logs a formatted message at the warn level.

Jump to

Keyboard shortcuts

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