Documentation
¶
Index ¶
- Constants
- Variables
- type ColorFlag
- type DestinationFlag
- type Destinations
- type LogHandler
- type LogLvl
- type LogMap
- type Logger
- func (l *Logger) Close()
- func (l *Logger) Debug(msg ...interface{})
- func (l *Logger) DisableDestinationLvl(lvl LogLvl)
- func (l *Logger) DisableDestinationLvlColor(lvl LogLvl, color ColorFlag)
- func (l *Logger) EnableDestinationLvl(lvl LogLvl)
- func (l *Logger) EnableDestinationLvlColor(lvl LogLvl, color ColorFlag)
- func (l *Logger) Error(msg ...interface{})
- func (l *Logger) Fatal(msg ...interface{})
- func (l *Logger) GetDestinationLvl(lvl LogLvl) []io.Writer
- func (l *Logger) GetDestinationLvlColor(lvl LogLvl, color ColorFlag) io.Writer
- func (l *Logger) Info(msg ...interface{})
- func (l *Logger) Log(lvl LogLvl, msg ...interface{})
- func (l *Logger) LogC(lvl LogLvl, cf ColorFlag, msg ...interface{})
- func (l *Logger) Other(msg ...interface{})
- func (l *Logger) P()
- func (l *Logger) Print(msg ...interface{})
- func (l *Logger) SetAndEnableDestinationLvl(lvl LogLvl, d []io.Writer)
- func (l *Logger) SetAndEnableDestinationLvlColor(lvl LogLvl, color ColorFlag, d io.Writer)
- func (l *Logger) SetColorScheme(cs colormap.CSM)
- func (l *Logger) SetColorThemeName(name string)
- func (l *Logger) SetDefaultDestinations(defaultWriter io.Writer, flag DestinationFlag)
- func (l *Logger) SetDestinationLvl(lvl LogLvl, sWriters []io.Writer)
- func (l *Logger) SetDestinationLvlColor(lvl LogLvl, color ColorFlag, writer io.Writer)
- func (l *Logger) SetNewDestinations(destinations Destinations)
- func (l *Logger) Test(msg ...interface{})
- func (l *Logger) Warning(msg ...interface{})
- type LoggerBean
- type LoggerController
- type LoggerI
Constants ¶
const ( Ldate = 1 << iota // the date in the local time zone: 2009/01/23 Ltime // the time in the local time zone: 01:23:23 Lmicroseconds // microsecond resolution: 01:23:23.123123. assumes Ltime. Llongfile // full file name and line number: /a/b/c/d.go:23 Lshortfile // final file name element and line number: d.go:23. overrides Llongfile Lutc // if Ldate or Ltime is set, use UTC rather than the local time zone LNoStackTrace // No Run runtime.Caller() for getting Stack Trace info LstdFlags = Ldate | Ltime // initial values for the standard Logger )
These flags define which text to prefix to each log entry generated by the LoggerI. Bits are or'ed together to control what's printed. For example, flags Ldate | Ltime (or LstdFlags) produce,
2009/01/23 01:23:23 message
while flags Ldate | Ltime | Lmicroseconds | Llongfile produce,
2009/01/23 01:23:23.123123 /a/b/c/d.go:23: message
Variables ¶
var LoggerColorSchemeDetached = map[LogLvl]colormap.CSN{ Info: colormap.CsInfo, Debug: colormap.CsDebug, Warning: colormap.CsWarning, Error: colormap.CsError, Fatal: colormap.CsFatalError, Test: colormap.CsTest, Print: colormap.CsPrint, P: colormap.CsPrint, Other: colormap.CsPrint, Db: colormap.CsDb, Redis: colormap.CsRedis, Memchd: colormap.CsMemchd, DbOk: colormap.CsDbOk, DbFail: colormap.CsDbFail, RedisOk: colormap.CsRedisOk, RedisFail: colormap.CsRedisFail, MemchdOk: colormap.CsMemchdOk, MemchdFail: colormap.CsMemchdFail, }
LoggerColorSchemeDetached - Привязка обозначений цветовой схемы colormap к уровням логирования
Functions ¶
This section is empty.
Types ¶
type DestinationFlag ¶
type DestinationFlag int
DestinationFlag - type of destination flag
const ( OffAll DestinationFlag = iota OnNoColor OnColor OnAll )
Const for destination
type Destinations ¶
Destinations - map of log_lvl/color destinations
func GetDefaultDestinations ¶
func GetDefaultDestinations() (defaultDest Destinations)
GetDefaultDestinations - get default destination
type LogHandler ¶
type LogHandler func(*Logger, ...interface{}) // Func which execute in specific Log method (Info, Debug and etc.)
LogHandler - function of handlers
type Logger ¶
type Logger struct { Destinations // TwoD-slice of io.Writers LogMap // Map []LogHandlers // contains filtered or unexported fields }
Logger -Main struct of Logger
func (*Logger) Close ¶
func (l *Logger) Close()
Close - close inner chan for transfer msg into Logger
func (*Logger) DisableDestinationLvl ¶
DisableDestinationLvl - disable destination lvl
func (*Logger) DisableDestinationLvlColor ¶
DisableDestinationLvlColor - disable destination lvl color
func (*Logger) EnableDestinationLvl ¶
EnableDestinationLvl - enable destination lvl
func (*Logger) EnableDestinationLvlColor ¶
EnableDestinationLvlColor - enable destination lvl color
func (*Logger) GetDestinationLvl ¶
GetDestinationLvl - get destination by lvl
func (*Logger) GetDestinationLvlColor ¶
GetDestinationLvlColor - get destination by lvl & color
func (*Logger) SetAndEnableDestinationLvl ¶
SetAndEnableDestinationLvl - set and enable destination lvl
func (*Logger) SetAndEnableDestinationLvlColor ¶
SetAndEnableDestinationLvlColor - set and enable destination lvl color
func (*Logger) SetColorScheme ¶
SetColorScheme - set color scheme
func (*Logger) SetColorThemeName ¶
SetColorThemeName - set color theme by name
func (*Logger) SetDefaultDestinations ¶
func (l *Logger) SetDefaultDestinations(defaultWriter io.Writer, flag DestinationFlag)
SetDefaultDestinations - set default destination
func (*Logger) SetDestinationLvl ¶
SetDestinationLvl - set destination to lvl
func (*Logger) SetDestinationLvlColor ¶
SetDestinationLvlColor - set destination to lvl & color
func (*Logger) SetNewDestinations ¶
func (l *Logger) SetNewDestinations(destinations Destinations)
SetNewDestinations - set new destination
type LoggerBean ¶
type LoggerBean struct { Output string DestFlag, N, CallDepth, SettingFlags int Delimiter, ThemeName string }
LoggerBean - Bean описывающий настройки логера
type LoggerController ¶
type LoggerController interface { SetColorScheme(colormap.CSM) SetColorThemeName(string) SetDefaultDestinations(io.Writer, DestinationFlag) SetNewDestinations(Destinations) SetDestinationLvl(LogLvl, []io.Writer) GetDestinationLvl(LogLvl) []io.Writer SetDestinationLvlColor(LogLvl, ColorFlag, io.Writer) GetDestinationLvlColor(LogLvl, ColorFlag) io.Writer DisableDestinationLvl(LogLvl) DisableDestinationLvlColor(LogLvl, ColorFlag) EnableDestinationLvl(LogLvl) EnableDestinationLvlColor(LogLvl, ColorFlag) SetAndEnableDestinationLvl(LogLvl, []io.Writer) SetAndEnableDestinationLvlColor(LogLvl, ColorFlag, io.Writer) }
LoggerController - sub interface for LoggerI (control action) Interface LoggerI Controller describes base control settings of Logger: color map and I/O mechanism) ALL METHOD UNDER MUTEX!
type LoggerI ¶
type LoggerI interface { Log(lvl LogLvl, msg ...interface{}) LogC(lvl LogLvl, cf ColorFlag, msg ...interface{}) Info(...interface{}) Debug(...interface{}) Warning(...interface{}) Error(...interface{}) Fatal(...interface{}) Test(...interface{}) Print(...interface{}) P() Other(...interface{}) LoggerController Close() }
LoggerI - Main interface of GoLogger