mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-10 15:07:29 +00:00
Add error & logSource hooks to backup & restore loggers
Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
This commit is contained in:
@@ -35,6 +35,7 @@ import (
|
||||
"github.com/heptio/ark/pkg/discovery"
|
||||
"github.com/heptio/ark/pkg/util/collections"
|
||||
kubeutil "github.com/heptio/ark/pkg/util/kube"
|
||||
"github.com/heptio/ark/pkg/util/logging"
|
||||
)
|
||||
|
||||
// Backupper performs backups.
|
||||
@@ -183,6 +184,8 @@ func (kb *kubernetesBackupper) Backup(backup *api.Backup, backupFile, logFile io
|
||||
|
||||
logger := logrus.New()
|
||||
logger.Out = gzippedLog
|
||||
logger.Hooks.Add(&logging.ErrorLocationHook{})
|
||||
logger.Hooks.Add(&logging.LogLocationHook{})
|
||||
log := logger.WithField("backup", kubeutil.NamespaceAndName(backup))
|
||||
log.Info("Starting backup")
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ import (
|
||||
"github.com/heptio/ark/pkg/restore/restorers"
|
||||
"github.com/heptio/ark/pkg/util/collections"
|
||||
"github.com/heptio/ark/pkg/util/kube"
|
||||
"github.com/heptio/ark/pkg/util/logging"
|
||||
)
|
||||
|
||||
// Restorer knows how to restore a backup.
|
||||
@@ -207,6 +208,8 @@ func (kr *kubernetesRestorer) Restore(restore *api.Restore, backup *api.Backup,
|
||||
|
||||
log := logrus.New()
|
||||
log.Out = gzippedLog
|
||||
log.Hooks.Add(&logging.ErrorLocationHook{})
|
||||
log.Hooks.Add(&logging.LogLocationHook{})
|
||||
|
||||
ctx := &context{
|
||||
backup: backup,
|
||||
|
||||
Reference in New Issue
Block a user