Merge branch 'cointop-sh:master' into feature/tcell

pull/232/head
Simon Roberts 3 years ago committed by GitHub
commit 8ce74b1886
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -78,10 +78,9 @@ func (ct *Cointop) UpdateMarketbar() error {
chartInfo := ""
if !ct.State.hideChart {
chartInfo = fmt.Sprintf(
"[ Chart: %s %s %s ] ",
"[ Chart: %s %s ] ",
charttitle,
timeframe,
ct.State.currencyConversion,
)
}
@ -92,8 +91,9 @@ func (ct *Cointop) UpdateMarketbar() error {
}
content = fmt.Sprintf(
"%sTotal Portfolio Value: %s • 24H: %s",
"%sTotal Portfolio Value %s: %s • 24H: %s",
chartInfo,
ct.State.currencyConversion,
ct.colorscheme.MarketBarLabelActive(totalstr),
percentChange24Hstr,
)
@ -142,10 +142,9 @@ func (ct *Cointop) UpdateMarketbar() error {
chartInfo := ""
if !ct.State.hideChart {
chartInfo = fmt.Sprintf(
"[ Chart: %s %s %s] ",
"[ Chart: %s %s] ",
ct.colorscheme.MarketBarLabelActive(chartname),
timeframe,
ct.State.currencyConversion,
)
}
@ -166,8 +165,9 @@ func (ct *Cointop) UpdateMarketbar() error {
}
content = fmt.Sprintf(
"%sGlobal ▶ Market Cap: %s %s 24H Volume: %s %s BTC Dominance: %.2f%%",
"%sGlobal %s ▶ Market Cap: %s %s 24H Volume: %s %s BTC Dominance: %.2f%%",
chartInfo,
ct.State.currencyConversion,
fmt.Sprintf("%s%s", ct.CurrencySymbol(), marketCapStr),
separator1,
fmt.Sprintf("%s%s", ct.CurrencySymbol(), volumeStr),

@ -493,3 +493,14 @@ draft: false
```bash
GO111MODULE=on go get github.com/cointop-sh/cointop
```
## How can I get more information when something is going wrong?
Cointop creates a logfile at `/tmp/cointop.log`. Normally nothing is written to this, but if you set the environment variable
`DEBUG=1` cointop will write a lot of output describing its operation. Furthermore, if you also set `DEBUG_HTTP=1` it will
emit lots about every HTTP request that cointop makes to coingecko (backend). Developers may ask for this information
to help diagnose any problems you may experience.
```bash
DEBUG=1 DEBUG_HTTP=1 cointop
```

@ -9,8 +9,11 @@ import (
"net/url"
"strings"
"os"
"github.com/cointop-sh/cointop/pkg/api/vendors/coingecko/format"
"github.com/cointop-sh/cointop/pkg/api/vendors/coingecko/v3/types"
log "github.com/sirupsen/logrus"
)
var baseURL = "https://api.coingecko.com/api/v3"
@ -31,6 +34,11 @@ func NewClient(httpClient *http.Client) *Client {
// helper
// doReq HTTP client
func doReq(req *http.Request, client *http.Client) ([]byte, error) {
debugHttp := os.Getenv("DEBUG_HTTP") != ""
if debugHttp {
log.Debugf("doReq %s %s", req.Method, req.URL)
}
resp, err := client.Do(req)
if err != nil {
return nil, err
@ -41,6 +49,10 @@ func doReq(req *http.Request, client *http.Client) ([]byte, error) {
return nil, err
}
if 200 != resp.StatusCode {
if debugHttp {
log.Warnf("doReq Got Status '%s' from %s %s", resp.Status, req.Method, req.URL)
log.Debugf("doReq Got Body: %s", body)
}
return nil, fmt.Errorf("%s", body)
}
return body, nil

Loading…
Cancel
Save