logging

package
v0.4.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Events = EventCatalog{
	GitHub: GitHubEvents{
		DiscoveryStarted:   "discovery_started",
		DiscoveryCompleted: "discovery_completed",
		DiscoveryFailed:    "discovery_failed",

		RateLimit: "github_rate_limit",
	},

	Inventory: InventoryEvents{
		Missing: "inventory_missing",
		Empty:   "inventory_empty",
	},

	Mirror: MirrorEvents{
		CloneStarted:   "mirror_clone_started",
		CloneCompleted: "mirror_clone_completed",
		CloneFailed:    "mirror_clone_failed",

		UpdateStarted:   "mirror_update_started",
		UpdateCompleted: "mirror_update_completed",
		UpdateFailed:    "mirror_update_failed",

		Retry: "mirror_retry",

		FsckStarted:   "mirror_fsck_started",
		FsckCompleted: "mirror_fsck_completed",
		FsckFailed:    "mirror_fsck_failed",

		StateSaveFailed: "mirror_state_save_failed",
	},

	Sync: SyncEvents{
		Started:   "sync_started",
		Completed: "sync_completed",
		Failed:    "sync_failed",
	},

	Snapshot: SnapshotEvents{
		Started:   "snapshot_started",
		Completed: "snapshot_completed",
		Failed:    "snapshot_failed",

		VerificationStarted: "snapshot_verification_started",
		VerificationPassed:  "snapshot_verification_passed",
		VerificationFailed:  "snapshot_verification_failed",

		RetentionDisabled:  "snapshot_retention_disabled",
		RetentionStarted:   "snapshot_retention_started",
		RetentionCompleted: "snapshot_retention_completed",
		RetentionFailed:    "snapshot_retention_failed",

		CollisionDetected: "snapshot_collision_detected",
	},

	Lock: LockEvents{
		Acquired: "lock_acquired",
		Released: "lock_released",
		Busy:     "lock_busy",
	},

	Health: HealthEvents{
		LowDisk:      "health_low_disk",
		RepoFailure:  "health_repo_failure",
		StaleBackup:  "health_stale_backup",
		HealthReport: "health_report_generated",
	},

	Restore: RestoreEvents{
		Started:   "restore_started",
		Completed: "restore_completed",
		Failed:    "restore_failed",
	},

	Filesystem: FilesystemEvents{
		DirectoryRecreated: "filesystem_directory_recreated",
	},
}

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Timestamp string `json:"ts"`

	Level Level `json:"level"`

	Event string `json:"event"`

	RunID string `json:"run_id,omitempty"`

	Repo string `json:"repo,omitempty"`

	DurationMS int64 `json:"duration_ms,omitempty"`

	Error string `json:"error,omitempty"`

	Details any `json:"details,omitempty"`
}

type EventCatalog

type EventCatalog struct {
	GitHub     GitHubEvents
	Inventory  InventoryEvents
	Mirror     MirrorEvents
	Snapshot   SnapshotEvents
	Lock       LockEvents
	Health     HealthEvents
	Restore    RestoreEvents
	Sync       SyncEvents
	Filesystem FilesystemEvents
}

type FilesystemEvents added in v0.4.4

type FilesystemEvents struct {
	DirectoryRecreated string
}

type GitHubEvents

type GitHubEvents struct {
	DiscoveryStarted   string
	DiscoveryCompleted string
	DiscoveryFailed    string

	RateLimit string
}

type HealthEvents

type HealthEvents struct {
	LowDisk      string
	RepoFailure  string
	StaleBackup  string
	HealthReport string
}

type InventoryEvents added in v0.4.4

type InventoryEvents struct {
	Missing string
	Empty   string
}

type Level

type Level string
const (
	Info  Level = "INFO"
	Warn  Level = "WARN"
	Error Level = "ERROR"
)

type LockEvents

type LockEvents struct {
	Acquired string
	Released string
	Busy     string
}

type Logger

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

func New

func New(logFile string) (*Logger, error)

func (*Logger) Close

func (l *Logger) Close() error

func (*Logger) Duration

func (l *Logger) Duration(
	event string,
	repo string,
	duration time.Duration,
)

func (*Logger) Emit

func (l *Logger) Emit(entry Entry)

func (*Logger) Error

func (l *Logger) Error(
	event string,
	repo string,
	err error,
)

func (*Logger) Info

func (l *Logger) Info(event string, repo string)

func (*Logger) Warn

func (l *Logger) Warn(
	event string,
	repo string,
	message string,
)

type MirrorEvents

type MirrorEvents struct {
	CloneStarted   string
	CloneCompleted string
	CloneFailed    string

	UpdateStarted   string
	UpdateCompleted string
	UpdateFailed    string

	Retry string

	FsckStarted   string
	FsckCompleted string
	FsckFailed    string

	StateSaveFailed string
}

type MirrorState

type MirrorState struct {
	Name        string `json:"name"`
	LastSuccess bool   `json:"last_success"`
	Error       string `json:"error,omitempty"`
}

type MirrorsState

type MirrorsState struct {
	GeneratedAt  string        `json:"generated_at"`
	Repositories []MirrorState `json:"repositories"`
}

type RestoreEvents

type RestoreEvents struct {
	Started   string
	Completed string
	Failed    string
}

type SnapshotEvents

type SnapshotEvents struct {
	Started   string
	Completed string
	Failed    string

	VerificationStarted string
	VerificationPassed  string
	VerificationFailed  string

	RetentionDisabled  string
	RetentionStarted   string
	RetentionCompleted string
	RetentionFailed    string

	CollisionDetected string
}

type SyncEvents

type SyncEvents struct {
	Started   string
	Completed string
	Failed    string
}

Jump to

Keyboard shortcuts

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