logging

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultLogger

func NewDefaultLogger() *slog.Logger

NewDefaultLogger returns default logger.

func NewLogger

func NewLogger(level string, isVerbose, isJSON bool) (*slog.Logger, error)

NewLogger creates a new logger with the given level, verbose, and JSON flags.

The level flag is used to set the log level. The valid values are: - debug - info - warn - error

func PrintBackupEstimate

func PrintBackupEstimate(
	ctx context.Context,
	stats *models.BackupStats,
	getMetrics func() *models.Metrics,
	logger *slog.Logger,
)

PrintBackupEstimate prints the backup progress. The progress is printed every second. The progress is printed only when the total records is greater than 0. The progress is printed only when the read records is greater than 0.

func PrintFilesNumber

func PrintFilesNumber(
	ctx context.Context,
	getNumber func() int64,
	fileTypes string,
	logger *slog.Logger,
)

PrintFilesNumber prints the number of files.

func PrintRestoreEstimate

func PrintRestoreEstimate(
	ctx context.Context,
	stats *models.RestoreStats,
	getMetrics func() *models.Metrics,
	getSize func() int64,
	logger *slog.Logger,
)

PrintRestoreEstimate prints the restore progress. The progress is printed every second. The progress is printed only when the total file size is greater than 0. The progress is printed only when the written number of bytes is greater than 0.

func ReportBackup

func ReportBackup(stats *bModels.BackupStats, isXdr, isJSON bool, logger *slog.Logger)

ReportBackup prints the backup report. if isJSON is true, it prints the report in JSON format, but logger must be passed

func ReportEstimate

func ReportEstimate(estimate uint64, isJSON bool, logger *slog.Logger)

ReportEstimate prints the estimate report. if isJSON is true, it prints the report in JSON format, but logger must be passed. estimate is the size of the backup file in bytes.

func ReportRestore

func ReportRestore(stats *bModels.RestoreStats, isValidation, isJSON bool, logger *slog.Logger)

ReportRestore prints the restore report. if isJSON is true, it prints the report in JSON format, but logger must be passed

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL