# README
MASS Client: Logging Package
Feature
- Format and output logs to console and file.
- Rotate old log files.
Usage
Initialization
logging.Init(path string, level string, age uint32, disableCPrint bool)
path
: path of log file.loglevel
: minimum log level to output.debug
,info
,warn
,error
,fatal
.age
: time to keep logs. One year by default.
Logging
logging.CPrint(level uint32, msg string, formats ...LogFormat) // Output to console and file.
logging.VPrint(level uint32, msg string, formats ...LogFormat) // Output only to file.
level
:debug
,info
,warn
,error
,fatal
.error
a call stack will be shown after logged.fatal
anexit
signal will be sent to system after logged.
msg
: log message.data
: extra content inLogFormat
(map of {k-v}).
type LogFormat = map[string]interface{}
Format in log files
tid
time
level
file
func
logline
# Functions
CPrint into stdout + log.
GetGID return gid.
Init loggers.
InitV2 loggers.
LoadFunctionHooker loads a function hooker to the logger.
NewFileRotateHooker enable log file output.
No description provided by the author
VPrint into log.
# Constants
DEBUG only log.
const.
ERROR has list msg.
const.
FATAL has list msg.
const.
INFO only log.
const.
MsgFormatMulti use show all func call relation.
MsgFormatSingle use info.
PANIC log level.
const.
TRACE only log.
const.
WARN only log.
const.
# Type aliases
LogFormat is to log format.