Documentation
¶
Index ¶
- func Assert(err error)
- func Dbg(prefix, msg string, args ...interface{})
- func Error(prefix, msg string, args ...interface{})
- func ExpLogs()
- func ExpVars(vars map[string]interface{})
- func FlushLogs(timeout int)
- func GetDebugging() bool
- func Jsonify(value interface{}, indent ...string) string
- func Log(prefix, msg string, args ...interface{})
- func RunDebugServer(host, port string) error
- func SetDebugging(onoff bool)
- func SetLogBuffer(size int) error
- func SetLogFile(filePath string) error
- func SetLogFilter(filter LogFilter)
- func SetLogRotate(size, keep int) error
- func StartDebugServer(host, port string)
- type Exception
- type LogFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Assert ¶
func Assert(err error)
Assert checks if err is nil or not, if not, it panics with that err.
func Dbg ¶
func Dbg(prefix, msg string, args ...interface{})
Dbg output message if current function is targeted for debugging. prefix is added to every single line of log output for tracing purpose.
func Error ¶
func Error(prefix, msg string, args ...interface{})
Error output message with stack trace. prefix is added to every single
func ExpVars ¶
func ExpVars(vars map[string]interface{})
ExpVars export configuration information to /debug/vars. It will by default export the following variables:
- epoch: start time of the current instance
- pid: process ID of current instance
- debugging: debug targets
- logging: logging configuration and runtime stats
This function should be called at program start-up.
func FlushLogs ¶
func FlushLogs(timeout int)
FlushLogs ensures log messages are flushed on program termination
func Log ¶
func Log(prefix, msg string, args ...interface{})
Log output message. prefix is added to every single line of log output for tracing purpose.
func RunDebugServer ¶
RunDebugServer run a standalone http server to server debugging end points (/debug/vars, /debug/pprof etc). It is only needed if the program is not already running an http server. Unlike StartDebugServer, this function should only be called as last statement of the main function.
func SetLogBuffer ¶
SetLogBuffer sets the size of log buffer. If logging is so frequent as to fill the buffer before flushing happens every 1 or 2 seconds, new messages will be dropped. Dropping of log messages can be monitored by /debug/vars if exposed.
func SetLogFile ¶
SetLogFile specifies desination for logs. If filePath is set to empty, logging will be effectively disabled.
func SetLogRotate ¶
SetLogRotate sets size of single log file, and the number of log files to keep.
func StartDebugServer ¶
func StartDebugServer(host, port string)
StartDebugServer calls RunDebugServer from a goroutine.