Skip to content

Commit

Permalink
Use backup routine name in logs (#58)
Browse files Browse the repository at this point in the history
* use routine name in log

* fix initial print

* revert log
  • Loading branch information
korotkov-aerospike authored Nov 22, 2023
1 parent e3656f1 commit e138245
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pkg/service/backup_scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ func newBackupHandler(config *model.Config, backupRoutine *model.BackupRoutine)

// Schedule schedules backup for the defining policy.
func (h *BackupHandler) Schedule(ctx context.Context) {
slog.Info("Scheduling full backup", "name", *h.backupPolicy.Name)
slog.Info("Scheduling full backup", "name", h.backupRoutine.Name)
h.scheduleBackupPeriodically(ctx, h.runFullBackup)

if h.backupRoutine.IncrIntervalMillis != nil && *h.backupRoutine.IncrIntervalMillis > 0 {
slog.Info("Scheduling incremental backup", "name", *h.backupPolicy.Name)
slog.Info("Scheduling incremental backup", "name", h.backupRoutine.Name)
h.scheduleBackupPeriodically(ctx, h.runIncrementalBackup)
}
}
Expand Down Expand Up @@ -237,7 +237,7 @@ func (h *BackupHandler) updateIncrementalBackupState() {

func (h *BackupHandler) writeState() {
if err := h.backend.writeState(h.state); err != nil {
slog.Error("Failed to write state for the backup", "name", *h.backupPolicy.Name, "err", err)
slog.Error("Failed to write state for the backup", "name", h.backupRoutine.Name, "err", err)
}
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/shared/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ func (b *BackupShared) BackupRun(backupRoutine *model.BackupRoutine, backupPolic
defer b.Unlock()
isIncremental := opts.ModAfter != nil
if isIncremental {
slog.Debug(fmt.Sprintf("Starting incremental backup for %s", *backupPolicy.Name))
slog.Debug(fmt.Sprintf("Starting incremental backup for %s", backupRoutine.Name))
} else {
slog.Debug(fmt.Sprintf("Starting full backup for %s", *backupPolicy.Name))
slog.Debug(fmt.Sprintf("Starting full backup for %s", backupRoutine.Name))
}

backupConfig := C.backup_config_t{}
Expand Down Expand Up @@ -122,7 +122,7 @@ func (b *BackupShared) BackupRun(backupRoutine *model.BackupRoutine, backupPolic
C.cf_free(unsafe.Pointer(backupStatus))
success = true
} else {
slog.Warn("Failed backup operation", "policy", *backupPolicy.Name)
slog.Warn("Failed backup operation", "policy", backupRoutine.Name)
}

// destroy the backup_config
Expand Down

0 comments on commit e138245

Please sign in to comment.