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) (*multiWriter, error)
- func SetupGlobalLogger() error
- func SetupSubLoggers(s []SubLoggerConfig) error
- func Warn(sl *SubLogger, data string)
- func Warnf(sl *SubLogger, data string, v ...interface{})
- func Warnln(sl *SubLogger, v ...interface{})
- type Config
- type Levels
- type Logger
- type Rotate
- type SubLogger
- 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{} )
Functions ¶
func Debugf ¶
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 ¶
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 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() error
SetupGlobalLogger setup the global loggers with the default global config values
func SetupSubLoggers ¶
func SetupSubLoggers(s []SubLoggerConfig) error
SetupSubLoggers configure all sub loggers with provided configuration values
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() *Config
GenDefaultSettings return struct with known sane/working logger settings
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 SubLogger ¶
type SubLogger struct {
// contains filtered or unexported fields
}
SubLogger defines a sub logger can be used externally for packages wanted to leverage GCT library logger features.
var ( SubLoggers = map[string]*SubLogger{} Global *SubLogger BackTester *SubLogger ConnectionMgr *SubLogger CommunicationMgr *SubLogger APIServerMgr *SubLogger ConfigMgr *SubLogger DatabaseMgr *SubLogger DataHistory *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 Trade *SubLogger Fill *SubLogger )
Global vars related to the logger package
func NewSubLogger ¶
NewSubLogger allows for a new sub logger to be registered.
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