Documentation ¶
Index ¶
- Constants
- Variables
- func CreateDefaultContextLogger(output string, level log.Level) (log.ContextLogger, error)
- func CreateDefaultErrorLogger(output string, level log.Level) (log.ErrorLogger, error)
- func DisableAllAccessLog()
- func EnableAllAccessLog()
- func GetErrorLoggersInfo() map[string]string
- func GetOrCreateDefaultErrorLogger(p string, level log.Level) (log.ErrorLogger, error)
- func GetOrCreateLogger(output string, roller *log.Roller) (*log.Logger, error)
- func InitDefaultLogger(output string, level log.Level) (err error)
- func NewAccessLog(output string, format string) (api.AccessLog, error)
- func ToggleLogger(p string, disable bool) bool
- func UpdateErrorLoggerLevel(p string, level log.Level) bool
- type CreateErrorLoggerFunc
- type ErrorLoggerManager
- func (mng *ErrorLoggerManager) Disable()
- func (mng *ErrorLoggerManager) DisableLogLevelControl()
- func (mng *ErrorLoggerManager) Enable()
- func (mng *ErrorLoggerManager) GetAllErrorLogger() map[string]string
- func (mng *ErrorLoggerManager) GetOrCreateErrorLogger(p string, level log.Level, f CreateErrorLoggerFunc) (log.ErrorLogger, error)
- func (mng *ErrorLoggerManager) SetAllErrorLoggerLevel(level log.Level)
- func (mng *ErrorLoggerManager) SetLogLevelControl(level log.Level)
- type Level
Constants ¶
const ( FATAL Level = log.FATAL ERROR = log.ERROR WARN = log.WARN INFO = log.INFO DEBUG = log.DEBUG TRACE = log.TRACE RAW = log.RAW )
const AccessLogLen = 1 << 8
Variables ¶
var ( DefaultDisableAccessLog bool ErrLogFormatUndefined = errors.New("access log format undefined") ErrEmptyVarDef = errors.New("access log format error: empty variable definition") ErrUnclosedVarDef = errors.New("access log format error: unclosed variable definition") UnknowDefaultValue = "-" )
RequestInfoFuncMap is a map which key is the format-key, value is the func to get corresponding string value
var ( DefaultLogger log.ErrorLogger StartLogger log.ErrorLogger Proxy log.ContextLogger ErrNoLoggerFound = errors.New("no logger found in logger manager") )
Functions ¶
func DisableAllAccessLog ¶
func DisableAllAccessLog()
func EnableAllAccessLog ¶ added in v0.14.0
func EnableAllAccessLog()
func GetErrorLoggersInfo ¶ added in v0.15.0
GetErrorLoggerInfo get the exists ErrorLogger
func GetOrCreateDefaultErrorLogger ¶
GetOrCreateDefaultErrorLogger used default create function
func GetOrCreateLogger ¶
func InitDefaultLogger ¶
InitDefaultLogger inits a default logger
func NewAccessLog ¶
NewAccessLog
func ToggleLogger ¶
ToggleLogger enable/disable the exists logger, include ErrorLogger and Logger
Types ¶
type CreateErrorLoggerFunc ¶
CreateErrorLoggerFunc creates a ErrorLogger implementation by output and level
var DefaultCreateErrorLoggerFunc CreateErrorLoggerFunc = CreateDefaultErrorLogger
The default function to CreateErrorLoggerFunc
type ErrorLoggerManager ¶
type ErrorLoggerManager struct {
// contains filtered or unexported fields
}
ErrorLoggerManager manages error log can be updated dynamicly
func GetErrorLoggerManagerInstance ¶
func GetErrorLoggerManagerInstance() *ErrorLoggerManager
Default Export Functions
func (*ErrorLoggerManager) Disable ¶ added in v0.14.0
func (mng *ErrorLoggerManager) Disable()
func (*ErrorLoggerManager) DisableLogLevelControl ¶ added in v0.14.0
func (mng *ErrorLoggerManager) DisableLogLevelControl()
func (*ErrorLoggerManager) Enable ¶ added in v0.14.0
func (mng *ErrorLoggerManager) Enable()
func (*ErrorLoggerManager) GetAllErrorLogger ¶ added in v0.15.0
func (mng *ErrorLoggerManager) GetAllErrorLogger() map[string]string
GetAllErrorLogger returns all of ErrorLogger info
func (*ErrorLoggerManager) GetOrCreateErrorLogger ¶
func (mng *ErrorLoggerManager) GetOrCreateErrorLogger(p string, level log.Level, f CreateErrorLoggerFunc) (log.ErrorLogger, error)
GetOrCreateErrorLogger returns a ErrorLogger based on the output(p). If Logger not exists, and create function is not nil, creates a new logger
func (*ErrorLoggerManager) SetAllErrorLoggerLevel ¶
func (mng *ErrorLoggerManager) SetAllErrorLoggerLevel(level log.Level)
func (*ErrorLoggerManager) SetLogLevelControl ¶ added in v0.14.0
func (mng *ErrorLoggerManager) SetLogLevelControl(level log.Level)