Documentation ¶
Index ¶
- Constants
- Variables
- func CloseLogger() error
- func Debug(sl *subLogger, data string)
- func Debugf(sl *subLogger, data string, v ...interface{})
- func Debugln(sl *subLogger, v ...interface{})
- func Error(sl *subLogger, data ...interface{})
- func Errorf(sl *subLogger, data string, v ...interface{})
- func Errorln(sl *subLogger, v ...interface{})
- func Info(sl *subLogger, data string)
- func Infof(sl *subLogger, data string, v ...interface{})
- func Infoln(sl *subLogger, v ...interface{})
- func MultiWriter(writers ...io.Writer) io.Writer
- func SetupGlobalLogger()
- func SetupSubLoggers(s []SubLoggerConfig)
- func Warn(sl *subLogger, data string)
- func Warnf(sl *subLogger, data string, v ...interface{})
- func Warnln(sl *subLogger, v ...interface{})
- type Config
- type Event
- type Levels
- type Logger
- type Rotate
- type SubLoggerConfig
Constants ¶
const ( // DefaultMaxFileSize for logger rotation file DefaultMaxFileSize int64 = 100 )
Variables ¶
var ( // FileLoggingConfiguredCorrectly flag set during config check if file logging meets requirements FileLoggingConfiguredCorrectly bool // GlobalLogConfig holds global configuration options for logger GlobalLogConfig = &Config{} // GlobalLogFile hold global configuration options for file logger GlobalLogFile = &Rotate{} // LogPath system path to store log files in LogPath string // RWM read/write mutex for logger RWM = &sync.RWMutex{} )
var ( Global *subLogger ConnectionMgr *subLogger CommunicationMgr *subLogger ConfigMgr *subLogger DatabaseMgr *subLogger GCTScriptMgr *subLogger OrderMgr *subLogger PortfolioMgr *subLogger SyncMgr *subLogger TimeMgr *subLogger WebsocketMgr *subLogger EventMgr *subLogger DispatchMgr *subLogger RequestSys *subLogger ExchangeSys *subLogger GRPCSys *subLogger RESTSys *subLogger Ticker *subLogger OrderBook *subLogger )
Global vars related to the logger package
Functions ¶
func Debug ¶
func Debug(sl *subLogger, data string)
Debug takes a pointer subLogger struct and string sends to multiwriter
func Debugf ¶
func Debugf(sl *subLogger, data string, v ...interface{})
Debugf takes a pointer subLogger struct, string & interface formats and sends to Info()
func Debugln ¶
func Debugln(sl *subLogger, v ...interface{})
Debugln takes a pointer subLogger struct, string and interface sends to newLogEvent
func Error ¶
func Error(sl *subLogger, data ...interface{})
Error takes a pointer subLogger struct & interface formats and sends to newLogEvent()
func Errorf ¶
func Errorf(sl *subLogger, data string, v ...interface{})
Errorf takes a pointer subLogger struct, string & interface formats and sends to Debug()
func Errorln ¶
func Errorln(sl *subLogger, v ...interface{})
Errorln takes a pointer subLogger struct, string & interface formats and sends to newLogEvent()
func Info ¶
func Info(sl *subLogger, data string)
Info takes a pointer subLogger struct and string sends to newLogEvent
func Infof ¶
func Infof(sl *subLogger, data string, v ...interface{})
Infof takes a pointer subLogger struct, string & interface formats and sends to Info()
func Infoln ¶
func Infoln(sl *subLogger, v ...interface{})
Infoln takes a pointer subLogger struct and interface sends to newLogEvent
func MultiWriter ¶
MultiWriter make and return a new copy of multiWriter
func SetupGlobalLogger ¶
func SetupGlobalLogger()
SetupGlobalLogger setup the global loggers with the default global config values
func SetupSubLoggers ¶
func SetupSubLoggers(s []SubLoggerConfig)
SetupSubLoggers configure all sub loggers with provided configuration values
func Warn ¶
func Warn(sl *subLogger, data string)
Warn takes a pointer subLogger struct & string and sends to newLogEvent()
Types ¶
type Config ¶
type Config struct { Enabled *bool `json:"enabled"` SubLoggerConfig LoggerFileConfig *loggerFileConfig `json:"fileSettings,omitempty"` AdvancedSettings advancedSettings `json:"advancedSettings"` SubLoggers []SubLoggerConfig `json:"subloggers,omitempty"` }
Config holds configuration settings loaded from bot config
func GenDefaultSettings ¶
func GenDefaultSettings() (log Config)
GenDefaultSettings return struct with known sane/working logger settings
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
Event holds the data sent to the log and which multiwriter to send to
type Levels ¶
type Levels struct {
Info, Debug, Warn, Error bool
}
Levels flags for each sub logger type
type Logger ¶
type Logger struct { ShowLogSystemName bool Timestamp string InfoHeader, ErrorHeader, DebugHeader, WarnHeader string Spacer string }
Logger each instance of logger settings
type Rotate ¶
type Rotate struct { FileName string Rotate *bool MaxSize int64 // contains filtered or unexported fields }
Rotate struct for each instance of Rotate
type SubLoggerConfig ¶
type SubLoggerConfig struct { Name string `json:"name,omitempty"` Level string `json:"level"` Output string `json:"output"` }
SubLoggerConfig holds sub logger configuration settings loaded from bot config