Documentation
¶
Index ¶
- func CloseMetadataWriter(w io.Writer) error
- func GetMetadataWriter(toLog bool) io.Writer
- func NewDefaultLogger() *slog.Logger
- func NewLogger(cfg *Config) (*slog.Logger, func() error, error)
- func PrintBackupDetailsByRoutine(data map[string][]api.DtoBackupDetails, isIncremental, toLog bool, ...)
- func PrintBackupDetailsForRoutine(data []api.DtoBackupDetails, name string, isIncremental, toLog bool, ...)
- func PrintBackupState(state *api.DtoRoutineState, name string, toLog bool, logger *slog.Logger)
- func PrintCluster(name string, cluster *api.DtoAerospikeCluster, toLog bool, logger *slog.Logger)
- func PrintClusters(clusters map[string]api.DtoAerospikeCluster, toLog bool, logger *slog.Logger)
- func PrintConfig(cfg *api.DtoConfig, toLog bool, logger *slog.Logger)
- func PrintMetadata(w io.Writer, data models.Metadata, toLog bool, logger *slog.Logger)
- func PrintPolicies(policies map[string]api.DtoBackupPolicy, toLog bool, logger *slog.Logger)
- func PrintPolicy(name string, policy *api.DtoBackupPolicy, toLog bool, logger *slog.Logger)
- func PrintRestoreJobs(jobs map[string]api.DtoRestoreJobStatus, toLog bool, logger *slog.Logger)
- func PrintRestoreStatus(status *api.DtoRestoreJobStatus, jobID int64, toLog bool, logger *slog.Logger)
- func PrintRoutine(name string, routine *api.DtoBackupRoutine, toLog bool, logger *slog.Logger)
- func PrintRoutines(routines map[string]api.DtoBackupRoutine, toLog bool, logger *slog.Logger)
- func PrintStorage(name string, storage *api.DtoStorage, toLog bool, logger *slog.Logger)
- func PrintStorageList(storage map[string]api.DtoStorage, toLog bool, logger *slog.Logger)
- func ReportBackup(stats *bModels.BackupStats, isXdr, toLog bool, logger *slog.Logger)
- func ReportEstimate(estimate uint64, toLog bool, logger *slog.Logger)
- func ReportRestore(stats *bModels.RestoreStats, isValidation, toLog bool, logger *slog.Logger)
- func SetOutWriter(w io.Writer) io.Writer
- type CobraLogger
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseMetadataWriter ¶ added in v1.1.0
CloseMetadataWriter flushes the metadata table.
func GetMetadataWriter ¶ added in v1.1.0
GetMetadataWriter returns a writer for the metadata table.
func NewDefaultLogger ¶
NewDefaultLogger returns default logger.
func NewLogger ¶
NewLogger creates a new logger with the given configuration. Returns logger, close function, and error.
func PrintBackupDetailsByRoutine ¶ added in v1.1.0
func PrintBackupDetailsByRoutine( data map[string][]api.DtoBackupDetails, isIncremental, toLog bool, logger *slog.Logger, )
PrintBackupDetailsByRoutine prints a per-routine grouped listing of backup details. When toLog is true the entire map is logged via slog; otherwise a table grouped by routine is rendered to stderr.
func PrintBackupDetailsForRoutine ¶ added in v1.1.0
func PrintBackupDetailsForRoutine( data []api.DtoBackupDetails, name string, isIncremental, toLog bool, logger *slog.Logger, )
PrintBackupDetailsForRoutine prints a flat listing of backup details for a single routine. When toLog is true the slice is logged via slog; otherwise a table is rendered to stderr.
func PrintBackupState ¶ added in v1.1.0
PrintBackupState prints the backup routine state for the given routine. When toLog is true the data is emitted as a structured log entry through the provided logger; otherwise it is rendered as a human-readable section to stderr.
func PrintCluster ¶ added in v1.1.0
PrintCluster prints a single cluster definition. When toLog is true the DTO is logged via slog; otherwise key fields are rendered as a section.
func PrintClusters ¶ added in v1.1.0
PrintClusters prints all configured clusters keyed by name. When toLog is true the entire map is logged via slog; otherwise a tabular summary is rendered to stderr.
func PrintConfig ¶ added in v1.1.0
PrintConfig prints the full service configuration. When toLog is true the entire DTO is logged as a structured entry; otherwise each section (clusters, policies, routines, storage) is rendered as its own table.
func PrintMetadata ¶ added in v1.1.0
PrintMetadata displays the node data in a formatted table.
func PrintPolicies ¶ added in v1.1.0
PrintPolicies prints all configured backup policies keyed by name. When toLog is true the entire map is logged via slog; otherwise a tabular summary is rendered to stderr.
func PrintPolicy ¶ added in v1.1.0
PrintPolicy prints a single backup policy. When toLog is true the DTO is logged via slog; otherwise key fields are rendered as a section.
func PrintRestoreJobs ¶ added in v1.1.0
PrintRestoreJobs prints a listing of restore jobs keyed by job ID. When toLog is true the data is emitted as a structured log entry; otherwise a table is rendered to stderr.
func PrintRestoreStatus ¶ added in v1.1.0
func PrintRestoreStatus(status *api.DtoRestoreJobStatus, jobID int64, toLog bool, logger *slog.Logger)
PrintRestoreStatus prints a single restore job status. When toLog is true the data is emitted as a structured log entry; otherwise it is rendered as a human-readable section to stderr.
func PrintRoutine ¶ added in v1.1.0
PrintRoutine prints a single backup routine. When toLog is true the DTO is logged via slog; otherwise key fields are rendered as a section.
func PrintRoutines ¶ added in v1.1.0
PrintRoutines prints all configured backup routines keyed by name. When toLog is true the entire map is logged via slog; otherwise a tabular summary is rendered to stderr.
func PrintStorage ¶ added in v1.1.0
PrintStorage prints a single storage definition. When toLog is true the DTO is logged via slog; otherwise key fields for the active provider are rendered as a section.
func PrintStorageList ¶ added in v1.1.0
PrintStorageList prints all configured storage entries keyed by name. When toLog is true the entire map is logged via slog; otherwise a tabular summary is rendered to stderr.
func ReportBackup ¶
func ReportBackup(stats *bModels.BackupStats, isXdr, toLog bool, logger *slog.Logger)
ReportBackup prints the backup report. if toLog is true, it prints the report to log, but logger must be passed
func ReportEstimate ¶
ReportEstimate prints the estimate report. if toLog is true, it prints the report to log, but logger must be passed estimate is the size of the backup file in bytes.
func ReportRestore ¶
func ReportRestore(stats *bModels.RestoreStats, isValidation, toLog bool, logger *slog.Logger)
ReportRestore prints the restore report. if toLog is true, it prints the report to log, but logger must be passed
Types ¶
type CobraLogger ¶
type CobraLogger struct {
// contains filtered or unexported fields
}
CobraLogger is a wrapper around slog to use it as the default writer for cobra output.
func NewCobraLogger ¶
func NewCobraLogger(logger *slog.Logger) *CobraLogger
NewCobraLogger returns a wrapper for logging cobra output.
type Config ¶ added in v1.1.0
type Config struct {
// Level is parsed when Verbose==true (keeps your original behavior).
// Valid: debug, info, warn, error.
Level string
Verbose bool
// JSON switches handler format for both stderr and file handlers.
JSON bool
// File used to write logs to the file.
File string
}