Improving log dump feature logs (#207)

This commit is contained in:
Igor Gov 2021-08-12 09:32:35 +03:00 committed by GitHub
parent e2db5087b8
commit 1d1b62ec4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,19 +42,19 @@ func DumpLogs(provider *kubernetes.Provider, ctx context.Context, filePath strin
if err := AddStrToZip(zipWriter, logs, fmt.Sprintf("%s.%s.log", pod.Namespace, pod.Name)); err != nil { if err := AddStrToZip(zipWriter, logs, fmt.Sprintf("%s.%s.log", pod.Namespace, pod.Name)); err != nil {
logger.Log.Errorf("Failed write logs, %v", err) logger.Log.Errorf("Failed write logs, %v", err)
} else { } else {
logger.Log.Infof("Successfully added log length %d from pod: %s.%s", len(logs), pod.Namespace, pod.Name) logger.Log.Debugf("Successfully added log length %d from pod: %s.%s", len(logs), pod.Namespace, pod.Name)
} }
} }
if err := AddFileToZip(zipWriter, config.GetConfigFilePath()); err != nil { if err := AddFileToZip(zipWriter, config.GetConfigFilePath()); err != nil {
logger.Log.Debugf("Failed write file, %v", err) logger.Log.Debugf("Failed write file, %v", err)
} else { } else {
logger.Log.Infof("Successfully added file %s", config.GetConfigFilePath()) logger.Log.Debugf("Successfully added file %s", config.GetConfigFilePath())
} }
if err := AddFileToZip(zipWriter, logger.GetLogFilePath()); err != nil { if err := AddFileToZip(zipWriter, logger.GetLogFilePath()); err != nil {
logger.Log.Debugf("Failed write file, %v", err) logger.Log.Debugf("Failed write file, %v", err)
} else { } else {
logger.Log.Infof("Successfully added file %s", logger.GetLogFilePath()) logger.Log.Debugf("Successfully added file %s", logger.GetLogFilePath())
} }
logger.Log.Infof("You can find the zip with all logs in %s\n", filePath) logger.Log.Infof("You can find the zip file with all logs in %s\n", filePath)
return nil return nil
} }