mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-19 23:16:48 +00:00
log: fix bug, expand test coverage and slightly optimize (#847)
* log: fix bugs expand coverage and optimise * log: fix linter issues * log: fix linter issue and pack methods in same file * log: drop defer * logger: move global check inside getfields and remove unused test function * logger: Increase note thanks @gloriouscode * logger: wrap error with writer type * logger: change variable name * logger: change variable names and remove validsublogger func as it doesn't add functionality over a standard map call * logs: error when unsupported output is applied on setup calls * logs: add glorious suggestion * logger: add protection to reduce olympic gold medal races * logger: fix linter issues * log: glorious niterinos
This commit is contained in:
@@ -3,6 +3,7 @@ package exchange
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
@@ -29,11 +30,13 @@ const (
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
c := log.GenDefaultSettings()
|
||||
log.RWM.Lock()
|
||||
log.GlobalLogConfig = &c
|
||||
log.GlobalLogConfig = log.GenDefaultSettings()
|
||||
log.RWM.Unlock()
|
||||
log.SetupGlobalLogger()
|
||||
if err := log.SetupGlobalLogger(); err != nil {
|
||||
fmt.Println("Cannot setup global logger. Error:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package kline
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"os"
|
||||
@@ -511,7 +512,11 @@ func TestItem_SortCandlesByTimestamp(t *testing.T) {
|
||||
func setupTest(t *testing.T) {
|
||||
t.Helper()
|
||||
if verbose {
|
||||
testhelpers.EnableVerboseTestOutput()
|
||||
err := testhelpers.EnableVerboseTestOutput()
|
||||
if err != nil {
|
||||
fmt.Printf("failed to enable verbose test output: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
Reference in New Issue
Block a user