New logging system (#319)

* First pass at adding new logging system

* NewLogger

* NewLogger

* WIP

* silly bug fix

* :D removed files

* removed old logging interface

* added tests

* added tests

* Started to add new lines to all f calls

* Added subsystem log types

* Logger improvements

* Further performance improvements

* changes to logger and sublogger creation

* Renamed Logging types

* removed old print statement

* changes based on feedback

* moved sublogger types to own file

* :)

* added console as output type

* added get level command

* added get/set log level via grpc command

* added check for output being empty for migration support

* first pass at log rotation

* added log rotation

* :D derp fixed

* added tests

* changes based on feedback

* changed log type

* comments

* renamed file -> fileSettings

* typo fix

* changes based on feedback

* gofmt ran on additional files

* gofmt ran on additional files
This commit is contained in:
Andrew
2019-07-07 05:20:31 +10:00
committed by Adrian Gallagher
parent 7112a89491
commit 3de1d94e5f
137 changed files with 2920 additions and 1650 deletions

View File

@@ -20,25 +20,25 @@ func (a *Alphapoint) WebsocketClient() {
a.WebsocketConn, _, err = Dialer.Dial(a.API.Endpoints.WebsocketURL, http.Header{})
if err != nil {
log.Errorf("%s Unable to connect to Websocket. Error: %s\n", a.Name, err)
log.Errorf(log.ExchangeSys, "%s Unable to connect to Websocket. Error: %s\n", a.Name, err)
continue
}
if a.Verbose {
log.Debugf("%s Connected to Websocket.\n", a.Name)
log.Debugf(log.ExchangeSys, "%s Connected to Websocket.\n", a.Name)
}
err = a.WebsocketConn.WriteMessage(websocket.TextMessage, []byte(`{"messageType": "logon"}`))
if err != nil {
log.Error(err)
log.Error(log.ExchangeSys, err)
return
}
for a.Enabled {
msgType, resp, err := a.WebsocketConn.ReadMessage()
if err != nil {
log.Error(err)
log.Error(log.ExchangeSys, err)
break
}
@@ -50,7 +50,7 @@ func (a *Alphapoint) WebsocketClient() {
msgType := MsgType{}
err := common.JSONDecode(resp, &msgType)
if err != nil {
log.Error(err)
log.Error(log.ExchangeSys, err)
continue
}
@@ -58,13 +58,13 @@ func (a *Alphapoint) WebsocketClient() {
ticker := WebsocketTicker{}
err = common.JSONDecode(resp, &ticker)
if err != nil {
log.Error(err)
log.Error(log.ExchangeSys, err)
continue
}
}
}
}
a.WebsocketConn.Close()
log.Debugf("%s Websocket client disconnected.", a.Name)
log.Debugf(log.ExchangeSys, "%s Websocket client disconnected.", a.Name)
}
}