logging

package
v1.99.99 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IgnorePercentage

func IgnorePercentage(_ logr.InfoLogger, _ float64)

func New

func New(out outFunc) io.Writer

New creates a writer which directly writes to the given logger function.

func NewBackupOutputParser

func NewBackupOutputParser(logger logr.Logger, folderName string, summaryFunc SummaryFunc) io.Writer

func NewErrorWriter

func NewErrorWriter(l logr.Logger) io.Writer

NewInfoWriter creates a writer which directly writes to the given logger using error level. It ensures that each line is handled seperately. This avoids mangled lines when parsing JSON outputs.

func NewInfoWriter

func NewInfoWriter(l logr.InfoLogger) io.Writer

NewInfoWriter creates a writer which directly writes to the given logger using info level. It ensures that each line is handled seperately. This avoids mangled lines when parsing JSON outputs.

func NewStdinBackupOutputParser

func NewStdinBackupOutputParser(logger logr.Logger, folderName string, summaryFunc SummaryFunc) io.Writer

func PrintPercentage

func PrintPercentage(logger logr.InfoLogger, p float64)

Types

type BackupEnvelope

type BackupEnvelope struct {
	MessageType string `json:"message_type,omitempty"`
	BackupStatus
	BackupSummary
	BackupError
}

type BackupError

type BackupError struct {
	Error struct {
		Op   string `json:"Op"`
		Path string `json:"Path"`
		Err  int    `json:"Err"`
	} `json:"error"`
	During string `json:"during"`
	Item   string `json:"item"`
}

type BackupOutputParser

type BackupOutputParser struct {
	// contains filtered or unexported fields
}

type BackupStatus

type BackupStatus struct {
	PercentDone  float64  `json:"percent_done"`
	TotalFiles   int      `json:"total_files"`
	FilesDone    int      `json:"files_done"`
	TotalBytes   int      `json:"total_bytes"`
	BytesDone    int      `json:"bytes_done"`
	CurrentFiles []string `json:"current_files"`
	ErrorCount   int      `json:"error_count"`
}

type BackupSummary

type BackupSummary struct {
	MessageType         string  `json:"message_type"`
	FilesNew            int     `json:"files_new"`
	FilesChanged        int     `json:"files_changed"`
	FilesUnmodified     int     `json:"files_unmodified"`
	DirsNew             int     `json:"dirs_new"`
	DirsChanged         int     `json:"dirs_changed"`
	DirsUnmodified      int     `json:"dirs_unmodified"`
	DataBlobs           int     `json:"data_blobs"`
	TreeBlobs           int     `json:"tree_blobs"`
	DataAdded           int64   `json:"data_added"`
	TotalFilesProcessed int     `json:"total_files_processed"`
	TotalBytesProcessed int     `json:"total_bytes_processed"`
	TotalDuration       float64 `json:"total_duration"`
	SnapshotID          string  `json:"snapshot_id"`
}

type LogErrPrinter

type LogErrPrinter struct {
	Log logr.Logger
}

type LogInfoPrinter

type LogInfoPrinter struct {
	// contains filtered or unexported fields
}

type PercentageFunc

type PercentageFunc func(logr.InfoLogger, float64)

PercentageFunc should format and print the given float.

type SummaryFunc

type SummaryFunc func(summary BackupSummary, errorCount int, folder string, startTimestamp, endTimestamp int64)

SummaryFunc takes the summed up status of the backup and will process this further like logging, metrics and webhooks.

Jump to

Keyboard shortcuts

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