mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-06 23:16:53 +00:00
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:
@@ -192,12 +192,12 @@ func (b *Bitstamp) GetOrderbook(currency string) (Orderbook, error) {
|
||||
for _, x := range resp.Bids {
|
||||
price, err := strconv.ParseFloat(x[0], 64)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
log.Error(log.ExchangeSys, err)
|
||||
continue
|
||||
}
|
||||
amount, err := strconv.ParseFloat(x[1], 64)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
log.Error(log.ExchangeSys, err)
|
||||
continue
|
||||
}
|
||||
orderbook.Bids = append(orderbook.Bids, OrderbookBase{price, amount})
|
||||
@@ -206,12 +206,12 @@ func (b *Bitstamp) GetOrderbook(currency string) (Orderbook, error) {
|
||||
for _, x := range resp.Asks {
|
||||
price, err := strconv.ParseFloat(x[0], 64)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
log.Error(log.ExchangeSys, err)
|
||||
continue
|
||||
}
|
||||
amount, err := strconv.ParseFloat(x[1], 64)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
log.Error(log.ExchangeSys, err)
|
||||
continue
|
||||
}
|
||||
orderbook.Asks = append(orderbook.Asks, OrderbookBase{price, amount})
|
||||
@@ -598,7 +598,7 @@ func (b *Bitstamp) SendAuthenticatedHTTPRequest(path string, v2 bool, values url
|
||||
}
|
||||
|
||||
if b.Verbose {
|
||||
log.Debugf("Sending POST request to " + path)
|
||||
log.Debugf(log.ExchangeSys, "Sending POST request to "+path)
|
||||
}
|
||||
|
||||
headers := make(map[string]string)
|
||||
|
||||
@@ -46,7 +46,7 @@ func (b *Bitstamp) WsConnect() error {
|
||||
}
|
||||
|
||||
if b.Verbose {
|
||||
log.Debugf("%s Connected to Websocket.\n", b.GetName())
|
||||
log.Debugf(log.ExchangeSys, "%s Connected to Websocket.\n", b.GetName())
|
||||
}
|
||||
|
||||
err = b.seedOrderBook()
|
||||
@@ -69,7 +69,7 @@ func (b *Bitstamp) WsReadData() (exchange.WebsocketResponse, error) {
|
||||
}
|
||||
|
||||
if b.Verbose {
|
||||
log.Debugf("%s websocket raw response: %s", b.GetName(), resp)
|
||||
log.Debugf(log.ExchangeSys, "%s websocket raw response: %s", b.GetName(), resp)
|
||||
}
|
||||
|
||||
b.Websocket.TrafficAlert <- struct{}{}
|
||||
@@ -106,7 +106,7 @@ func (b *Bitstamp) WsHandleData() {
|
||||
switch wsResponse.Event {
|
||||
case "bts:request_reconnect":
|
||||
if b.Verbose {
|
||||
log.Debugf("%v - Websocket reconnection request received", b.GetName())
|
||||
log.Debugf(log.ExchangeSys, "%v - Websocket reconnection request received", b.GetName())
|
||||
}
|
||||
go b.Websocket.WebsocketReset()
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ func (b *Bitstamp) Start(wg *sync.WaitGroup) {
|
||||
// Run implements the Bitstamp wrapper
|
||||
func (b *Bitstamp) Run() {
|
||||
if b.Verbose {
|
||||
log.Debugf("%s Websocket: %s.", b.GetName(), common.IsEnabled(b.Websocket.IsEnabled()))
|
||||
log.Debugf(log.ExchangeSys, "%s Websocket: %s.", b.GetName(), common.IsEnabled(b.Websocket.IsEnabled()))
|
||||
b.PrintEnabledPairs()
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ func (b *Bitstamp) Run() {
|
||||
|
||||
err := b.UpdateTradablePairs(false)
|
||||
if err != nil {
|
||||
log.Errorf("%s failed to update tradable pairs. Err: %s", b.Name, err)
|
||||
log.Errorf(log.ExchangeSys, "%s failed to update tradable pairs. Err: %s", b.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ func (b *Bitstamp) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest)
|
||||
case order.XRP > 0:
|
||||
baseCurrency = currency.XRP
|
||||
default:
|
||||
log.Warnf("no base currency found for OrderID '%v'", order.OrderID)
|
||||
log.Warnf(log.ExchangeSys, "no base currency found for OrderID '%v'", order.OrderID)
|
||||
}
|
||||
|
||||
switch {
|
||||
@@ -498,7 +498,7 @@ func (b *Bitstamp) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest)
|
||||
case order.EUR > 0:
|
||||
quoteCurrency = currency.EUR
|
||||
default:
|
||||
log.Warnf("no quote currency found for orderID '%v'", order.OrderID)
|
||||
log.Warnf(log.ExchangeSys, "no quote currency found for orderID '%v'", order.OrderID)
|
||||
}
|
||||
|
||||
var currPair currency.Pair
|
||||
|
||||
Reference in New Issue
Block a user