audit

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateID

func GenerateID() string

GenerateID generates a simple unique ID for activities

Types

type Activity

type Activity struct {
	ID        string                 `json:"id"`
	Type      ActivityType           `json:"type"`
	Actor     string                 `json:"actor"`
	Resource  string                 `json:"resource"`
	Server    string                 `json:"server"`
	Command   string                 `json:"command,omitempty"`
	Output    string                 `json:"output,omitempty"`
	Error     string                 `json:"error,omitempty"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
	Duration  time.Duration          `json:"duration,omitempty"`
	Timestamp time.Time              `json:"timestamp"`
}

Activity represents a logged activity

type ActivityType

type ActivityType string

ActivityType represents the type of activity

const (
	ActivityServerProvisioned   ActivityType = "server.provisioned"
	ActivityServerConnected     ActivityType = "server.connected"
	ActivityDeploymentStarted   ActivityType = "deployment.started"
	ActivityDeploymentCompleted ActivityType = "deployment.completed"
	ActivityDeploymentFailed    ActivityType = "deployment.failed"
	ActivityResourceDeleted     ActivityType = "resource.deleted"
	ActivityCommandExecuted     ActivityType = "command.executed"
	ActivityTakodMeshPrepared   ActivityType = "takod.mesh.prepared"
	ActivityNodeJoined          ActivityType = "node.joined"
)

type FileLogger

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

FileLogger logs activities to JSON files

func NewFileLogger

func NewFileLogger(basePath string) (*FileLogger, error)

NewFileLogger creates a new file-based activity logger

func (*FileLogger) Close

func (l *FileLogger) Close() error

Close closes the logger (noop for file logger)

func (*FileLogger) Log

func (l *FileLogger) Log(activity *Activity) error

Log writes an activity to the log file

type Logger

type Logger interface {
	Log(activity *Activity) error
	Close() error
}

Logger defines the interface for activity logging

type NoOpLogger

type NoOpLogger struct{}

NoOpLogger is a logger that does nothing

func NewNoOpLogger

func NewNoOpLogger() *NoOpLogger

NewNoOpLogger creates a no-op logger

func (*NoOpLogger) Close

func (n *NoOpLogger) Close() error

Close does nothing

func (*NoOpLogger) Log

func (n *NoOpLogger) Log(activity *Activity) error

Log does nothing

Jump to

Keyboard shortcuts

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