logger

package
v0.0.0-...-2946602 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const LOGGER_TOPIC = "System-Log"
View Source
const SPLIT_LINE = "\n----------------------------------------------------\n"

Variables

View Source
var OperateLogSocketClient *websocket.Conn
View Source
var SocketClient = websocket.Upgrader{
	HandshakeTimeout:  30 * time.Second,
	ReadBufferSize:    2048,
	WriteBufferSize:   2048,
	WriteBufferPool:   nil,
	Subprotocols:      nil,
	Error:             nil,
	CheckOrigin:       nil,
	EnableCompression: false,
}
View Source
var SystemLogSocketClient *websocket.Conn

Functions

func AddBlackList

func AddBlackList(ip string)

func DeleteBlackList

func DeleteBlackList(ip string)

func Error

func Error(err error, mes string)

Error 打印错误信息

func Fatal

func Fatal(err error, mes string)

Fatal 慎用,会导致程序退出!

func Info

func Info(mes string)

Info 打印普通信息

func ReadBlackList

func ReadBlackList() []string

func Waring

func Waring(err error, mes string)

Waring 打印警告信息

Types

type LogHeader

type LogHeader string
const (
	FATAL_HEADER  LogHeader = "$#8000fa$(致命问题)"
	ERROR_HEADER  LogHeader = "$#e50c3e$(错误)"
	WARING_HEADER LogHeader = "$#fabe07$(警告)"
	INFO_HEADER   LogHeader = "$#04ea5f$(信息)"
)

type LogType

type LogType string
const (
	FATAL  LogType = "fatal"
	ERROR  LogType = "error"
	INFO   LogType = "info"
	WARING LogType = "waring"
)

type Logger

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

Logger 打印日志到系统日志文件中,应符合日志打印的基本原则

Jump to

Keyboard shortcuts

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