Documentation ¶
Index ¶
- Constants
- Variables
- func CloseLogger() error
- func Debugf(sl *SubLogger, data string, v ...interface{})
- func DebugfWithFields(sl *SubLogger, extra ExtraFields, format string, a ...interface{})
- func Debugln(sl *SubLogger, v ...interface{})
- func DebuglnWithFields(sl *SubLogger, extra ExtraFields, a ...interface{})
- func Errorf(sl *SubLogger, data string, v ...interface{})
- func ErrorfWithFields(sl *SubLogger, extra ExtraFields, format string, a ...interface{})
- func Errorln(sl *SubLogger, v ...interface{})
- func ErrorlnWithFields(sl *SubLogger, extra ExtraFields, a ...interface{})
- func GetLogPath() string
- func Infof(sl *SubLogger, format string, a ...interface{})
- func InfofWithFields(sl *SubLogger, extra ExtraFields, format string, a ...interface{})
- func Infoln(sl *SubLogger, a ...interface{})
- func InfolnWithFields(sl *SubLogger, extra ExtraFields, a ...interface{})
- func SetFileLoggingState(correctlyConfigured bool)
- func SetGlobalLogConfig(incoming *Config) error
- func SetLogPath(newLogPath string) error
- func SetupGlobalLogger(botName string, structuredOutput bool) error
- func SetupSubLoggers(s []SubLoggerConfig) error
- func Warnf(sl *SubLogger, data string, v ...interface{})
- func WarnfWithFields(sl *SubLogger, extra ExtraFields, format string, a ...interface{})
- func Warnln(sl *SubLogger, v ...interface{})
- func WarnlnWithFields(sl *SubLogger, extra ExtraFields, a ...interface{})
- type Config
- type ExtraFields
- type Key
- type Levels
- type Logger
- type Rotate
- type SubLogger
- type SubLoggerConfig
Constants ¶
const ( // DefaultMaxFileSize for logger rotation file DefaultMaxFileSize int64 = 100 )
Variables ¶
var ( // ErrSubLoggerAlreadyRegistered Returned when a sublogger is registered multiple times ErrSubLoggerAlreadyRegistered = errors.New("sub logger already registered") )
Functions ¶
func Debugf ¶
Debugf is a logging function that takes a sublogger, a format string along with optional arguments. This writes to configured io.Writer(s) as an debug message which formats according to the format specifier. A new line is automatically added to the output.
func DebugfWithFields ¶
func DebugfWithFields(sl *SubLogger, extra ExtraFields, format string, a ...interface{})
DebugfWithFields is a logging function that takes a sublogger, additional structured logging fields, a format string along with optional arguments. This writes to configured io.Writer(s) as an debug message which formats according to the format specifier. A new line is automatically added to the output. If structured logging is not enabled, the fields will be ignored.
func Debugln ¶
func Debugln(sl *SubLogger, v ...interface{})
Debugln is a logging function that takes a sublogger and an arbitrary number of interface{} arguments. This writes to configured io.Writer(s) as an debug message using default formats for its operands. A new line is automatically added to the output.
func DebuglnWithFields ¶
func DebuglnWithFields(sl *SubLogger, extra ExtraFields, a ...interface{})
DebuglnWithFields is a logging function that takes a sublogger, additional structured logging fields and an arbitrary number of interface{} arguments. This writes to configured io.Writer(s) as an debug message using default formats for its operands. A new line is automatically added to the output. If structured logging is not enabled, the fields will be ignored.
func Errorf ¶
Errorf is a logging function that takes a sublogger, a format string along with optional arguments. This writes to configured io.Writer(s) as an error message which formats according to the format specifier. A new line is automatically added to the output.
func ErrorfWithFields ¶
func ErrorfWithFields(sl *SubLogger, extra ExtraFields, format string, a ...interface{})
ErrorfWithFields is a logging function that takes a sublogger, additional structured logging fields, a format string along with optional arguments. This writes to configured io.Writer(s) as an error message which formats according to the format specifier. A new line is automatically added to the output. If structured logging is not enabled, the fields will be ignored.
func Errorln ¶
func Errorln(sl *SubLogger, v ...interface{})
Errorln is a logging function that takes a sublogger and an arbitrary number of interface{} arguments. This writes to configured io.Writer(s) as an error message using default formats for its operands. A new line is automatically added to the output.
func ErrorlnWithFields ¶
func ErrorlnWithFields(sl *SubLogger, extra ExtraFields, a ...interface{})
ErrorlnWithFields is a logging function that takes a sublogger, additional structured logging fields and an arbitrary number of interface{} arguments. This writes to configured io.Writer(s) as an error message using default formats for its operands. A new line is automatically added to the output. If structured logging is not enabled, the fields will be ignored.
func Infof ¶
Infof is a logging function that takes a sublogger, a format string along with optional arguments. This writes to configured io.Writer(s) as an information message which formats according to the format specifier. A new line is automatically added to the output.
func InfofWithFields ¶
func InfofWithFields(sl *SubLogger, extra ExtraFields, format string, a ...interface{})
InfofWithFields is a logging function that takes a sublogger, additional structured logging fields, a format string along with optional arguments. This writes to configured io.Writer(s) as an information message which formats according to the format specifier. A new line is automatically added to the output. If structured logging is not enabled, the fields will be ignored.
func Infoln ¶
func Infoln(sl *SubLogger, a ...interface{})
Infoln is a logging function that takes a sublogger and an arbitrary number of interface{} arguments. This writes to configured io.Writer(s) as an information message using default formats for its operands. A new line is automatically added to the output.
func InfolnWithFields ¶
func InfolnWithFields(sl *SubLogger, extra ExtraFields, a ...interface{})
InfolnWithFields is a logging function that takes a sublogger, additional structured logging fields and an arbitrary number of interface{} arguments. This writes to configured io.Writer(s) as an information message using default formats for its operands. A new line is automatically added to the output. If structured logging is not enabled, the fields will be ignored.
func SetFileLoggingState ¶
func SetFileLoggingState(correctlyConfigured bool)
SetFileLoggingState can set file logging state if it is correctly configured or not. This will bypass the ability to log to file if set as false.
func SetGlobalLogConfig ¶
SetGlobalLogConfig sets the global config with the supplied config
func SetLogPath ¶
SetLogPath sets the log path for writing to file
func SetupGlobalLogger ¶
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
func Warnf ¶
Warnf is a logging function that takes a sublogger, a format string along with optional arguments. This writes to configured io.Writer(s) as an warning message which formats according to the format specifier. A new line is automatically added to the output.
func WarnfWithFields ¶
func WarnfWithFields(sl *SubLogger, extra ExtraFields, format string, a ...interface{})
WarnfWithFields is a logging function that takes a sublogger, additional structured logging fields, a format string along with optional arguments. This writes to configured io.Writer(s) as an warning message which formats according to the format specifier. A new line is automatically added to the output. If structured logging is not enabled, the fields will be ignored.
func Warnln ¶
func Warnln(sl *SubLogger, v ...interface{})
Warnln is a logging function that takes a sublogger and an arbitrary number of interface{} arguments. This writes to configured io.Writer(s) as an warning message using default formats for its operands. A new line is automatically added to the output.
func WarnlnWithFields ¶
func WarnlnWithFields(sl *SubLogger, extra ExtraFields, a ...interface{})
WarnlnWithFields is a logging function that takes a sublogger, additional structured logging fields and an arbitrary number of interface{} arguments. This writes to configured io.Writer(s) as an warning message using default formats for its operands. A new line is automatically added to the output. If structured logging is not enabled, the fields will be ignored.
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 ExtraFields ¶
type ExtraFields map[Key]interface{}
ExtraFields is a map of key value pairs that can be added to a structured log output.
type Key ¶
type Key string
Key is used for structured logging fields to ensure no collisions occur. Unexported keys are default fields which cannot be overwritten.
type Levels ¶
type Levels struct {
Info, Debug, Warn, Error bool
}
Levels flags for each sub logger type
type Logger ¶
type Logger struct { ShowLogSystemName bool BypassJobChannelFilledWarning bool TimestampFormat string InfoHeader, ErrorHeader, DebugHeader, WarnHeader string Spacer string Level string // contains filtered or unexported fields }
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 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 Currency *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