log

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EndSession

func EndSession() error

EndSession saves the current session to disk

func GetLogPath

func GetLogPath() (string, error)

func Initialize

func Initialize(enabled bool, retentionDays int)

Initialize sets up the logging system with the given configuration

func LogCreateDir

func LogCreateDir(dirPath string, success bool, err error)

LogCreateDir logs a directory creation

func LogDelete

func LogDelete(path string, success bool, err error)

LogDelete logs a delete operation

func LogLink(sourcePath, destPath string, success bool, err error)

LogLink logs a link operation

func LogOperation

func LogOperation(opType OperationType, sourcePath, destPath string, success bool, err error)

LogOperation logs a generic operation to the current session

func LogRename

func LogRename(sourcePath, destPath string, success bool, err error)

LogRename logs a rename operation

func StartSession

func StartSession(command string, args []string) error

StartSession initializes a new logging session

func UndoSession

func UndoSession(session *LogSession) (successful int, failed int, errors []error)

func WriteSession

func WriteSession(session *LogSession) error

Types

type LogSession

type LogSession struct {
	Metadata   SessionMetadata `json:"metadata"`
	Operations []OperationLog  `json:"operations"`
}

func FindLatestSession

func FindLatestSession() (*LogSession, string, error)

func ReadSession

func ReadSession(logPath string) (*LogSession, error)

func ReadSessions

func ReadSessions(limit int) ([]*LogSession, error)

type OperationLog

type OperationLog struct {
	ID         string        `json:"id"`
	Timestamp  time.Time     `json:"timestamp"`
	Type       OperationType `json:"type"`
	SourcePath string        `json:"source_path"`
	DestPath   string        `json:"dest_path,omitempty"`
	Success    bool          `json:"success"`
	Error      string        `json:"error,omitempty"`
}

type OperationType

type OperationType string
const (
	OpRename    OperationType = "rename"
	OpLink      OperationType = "link"
	OpDelete    OperationType = "delete"
	OpCreateDir OperationType = "create_dir"
)

type SessionMetadata

type SessionMetadata struct {
	CommandArgs   []string  `json:"command_args"`
	WorkingDir    string    `json:"working_dir"`
	Timestamp     time.Time `json:"timestamp"`
	SessionID     string    `json:"session_id"`
	TotalOps      int       `json:"total_operations"`
	SuccessfulOps int       `json:"successful_operations"`
	FailedOps     int       `json:"failed_operations"`
}

type SessionSummary

type SessionSummary struct {
	Session      *LogSession
	FilePath     string
	RelativeTime string
	Icon         string
}

func GetSessionSummaries

func GetSessionSummaries() ([]SessionSummary, error)

type UndoResult

type UndoResult struct {
	Operation OperationLog
	Success   bool
	Error     error
}

func UndoOperation

func UndoOperation(op OperationLog) UndoResult

Jump to

Keyboard shortcuts

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