mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-09 07:26:48 +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:
@@ -201,7 +201,7 @@ func SendHTTPRequest(method, urlPath string, headers map[string]string, body io.
|
||||
// on failure.
|
||||
func SendHTTPGetRequest(urlPath string, jsonDecode, isVerbose bool, result interface{}) error {
|
||||
if isVerbose {
|
||||
log.Debugf("Raw URL: %s", urlPath)
|
||||
log.Debugf(log.Global, "Raw URL: %s\n", urlPath)
|
||||
}
|
||||
|
||||
initialiseHTTPClient()
|
||||
@@ -221,7 +221,7 @@ func SendHTTPGetRequest(urlPath string, jsonDecode, isVerbose bool, result inter
|
||||
}
|
||||
|
||||
if isVerbose {
|
||||
log.Debugf("Raw Resp: %s", string(contents))
|
||||
log.Debugf(log.Global, "Raw Resp: %s\n", string(contents))
|
||||
}
|
||||
|
||||
defer res.Body.Close()
|
||||
@@ -336,7 +336,7 @@ func GetDefaultDataDir(env string) string {
|
||||
|
||||
dir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
log.Warn("Environment variable unset, defaulting to current directory")
|
||||
log.Warnln(log.Global, "Environment variable unset, defaulting to current directory")
|
||||
dir = "."
|
||||
}
|
||||
return filepath.Join(dir, ".gocryptotrader")
|
||||
@@ -349,7 +349,7 @@ func CreateDir(dir string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
log.Warnf("Directory %s does not exist.. creating.", dir)
|
||||
log.Warnf(log.Global, "Directory %s does not exist.. creating.\n", dir)
|
||||
return os.MkdirAll(dir, 0770)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user