logging

package
v0.0.0-...-1107578 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2018 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEBUG   = "debug"
	INFO    = "info"
	WARNING = "warning"
	ERROR   = "error"
)

Variables

Functions

func CheckLogLevel

func CheckLogLevel(lv string) bool

func GetAllLogLevelsString

func GetAllLogLevelsString(sep string) string

func GetJsonFormat

func GetJsonFormat() *myLogger.JSONFormatter

func GetLogrusLogLevel

func GetLogrusLogLevel(lv string) myLogger.Level

func GetTextFormat

func GetTextFormat() *myLogger.TextFormatter

func NewRawLogger

func NewRawLogger(lv string) *myLogger.Logger

func SetLogLevel

func SetLogLevel(lg *myLogger.Logger, lv string)

func WriteLogOnlyMsg

func WriteLogOnlyMsg(logWr *myLogger.Logger, msg string, level string)

func WriteToLog

func WriteToLog(logWr *myLogger.Logger, fields myLogger.Fields, msg string, level string)

func WriteToLogNoExtraMsg

func WriteToLogNoExtraMsg(logWr *myLogger.Logger, fields myLogger.Fields, level string)

Types

type LogConf

type LogConf struct {
	LogFile   string `mapstructure:"logfile"`
	LogLevel  string `mapstructure:"loglevel"`
	LogFormat string `mapstructure:"logformat"`
}

func (*LogConf) CreateNewLogger

func (logCf *LogConf) CreateNewLogger() *myLogger.Logger

logFile: full path of log file. default, os.Stdout is used logLevel: debug, info, warning, error. default warning is used format: json, text

type MyLog

type MyLog struct {
	Logger *myLogger.Logger
	LogCfg LogConf
	Wlock  *sync.RWMutex
}

func (*MyLog) CreateNewRawLogger

func (this *MyLog) CreateNewRawLogger()

func (*MyLog) ExitProgram

func (this *MyLog) ExitProgram(errcode int, msg string)

func (*MyLog) GenLogFields

func (this *MyLog) GenLogFields(msg string, errCode int) map[string]interface{}

func (*MyLog) SetLogConf

func (this *MyLog) SetLogConf()

func (*MyLog) WriteToLogByFields

func (this *MyLog) WriteToLogByFields(msgMap map[string]interface{}, level string, iflogStack bool, exitCode int, ifExitProgram bool)

func (*MyLog) WriteToLogByFieldsError

func (this *MyLog) WriteToLogByFieldsError(err error, extMsg string, level string, ifStack bool, errCode int, ifExit bool)

func (*MyLog) WriteToLogByFieldsErrorExit

func (this *MyLog) WriteToLogByFieldsErrorExit(err error, level string, errCode int)

func (*MyLog) WriteToLogByFieldsErrorExtramsg

func (this *MyLog) WriteToLogByFieldsErrorExtramsg(err error, extMsg string, level string)

func (*MyLog) WriteToLogByFieldsErrorExtramsgExit

func (this *MyLog) WriteToLogByFieldsErrorExtramsgExit(err error, extMsg string, level string, errCode int)

func (*MyLog) WriteToLogByFieldsErrorExtramsgExitCode

func (this *MyLog) WriteToLogByFieldsErrorExtramsgExitCode(err error, extMsg string, level string, exitCode int)

func (*MyLog) WriteToLogByFieldsErrorExtramsgStack

func (this *MyLog) WriteToLogByFieldsErrorExtramsgStack(err error, extMsg string, level string)

func (*MyLog) WriteToLogByFieldsErrorExtramsgStackExit

func (this *MyLog) WriteToLogByFieldsErrorExtramsgStackExit(err error, extMsg string, level string, errCode int)

func (*MyLog) WriteToLogByFieldsErrorNormal

func (this *MyLog) WriteToLogByFieldsErrorNormal(err error, level string)

func (*MyLog) WriteToLogByFieldsErrorStack

func (this *MyLog) WriteToLogByFieldsErrorStack(err error, level string)

func (*MyLog) WriteToLogByFieldsErrorStackExit

func (this *MyLog) WriteToLogByFieldsErrorStackExit(err error, level string, errCode int)

func (*MyLog) WriteToLogByFieldsExit

func (this *MyLog) WriteToLogByFieldsExit(msgMap map[string]interface{}, level string, exitCode int)

func (*MyLog) WriteToLogByFieldsExitMsgNoErr

func (this *MyLog) WriteToLogByFieldsExitMsgNoErr(msg string, level string, exitCode int)

func (*MyLog) WriteToLogByFieldsExitMsgNoErrStack

func (this *MyLog) WriteToLogByFieldsExitMsgNoErrStack(msg string, level string, exitCode int)

func (*MyLog) WriteToLogByFieldsNormal

func (this *MyLog) WriteToLogByFieldsNormal(msgMap map[string]interface{}, level string)

func (*MyLog) WriteToLogByFieldsNormalOnlyMsg

func (this *MyLog) WriteToLogByFieldsNormalOnlyMsg(msg string, level string)

func (*MyLog) WriteToLogByFieldsNormalOnlyMsgExitCode

func (this *MyLog) WriteToLogByFieldsNormalOnlyMsgExitCode(msg string, level string, exitCode int)

func (*MyLog) WriteToLogByFieldsNormalOnlyMsgStack

func (this *MyLog) WriteToLogByFieldsNormalOnlyMsgStack(msg string, level string)

func (*MyLog) WriteToLogByFieldsStack

func (this *MyLog) WriteToLogByFieldsStack(msgMap map[string]interface{}, level string)

func (*MyLog) WriteToLogByFieldsStackExit

func (this *MyLog) WriteToLogByFieldsStackExit(msgMap map[string]interface{}, level string, exitCode int)

func (*MyLog) WriteToLogByMsg

func (this *MyLog) WriteToLogByMsg(msg string, level string, iflogStack bool, exitCode int, ifExitProgram bool)

func (*MyLog) WriteToLogByMsgExit

func (this *MyLog) WriteToLogByMsgExit(msg string, level string, exitCode int)

func (*MyLog) WriteToLogByMsgNormal

func (this *MyLog) WriteToLogByMsgNormal(msg string, level string)

func (*MyLog) WriteToLogByMsgStack

func (this *MyLog) WriteToLogByMsgStack(msg string, level string)

func (*MyLog) WriteToLogByMsgStackExit

func (this *MyLog) WriteToLogByMsgStackExit(msg string, level string, exitCode int)

Jump to

Keyboard shortcuts

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