trail

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package trail provides audit trail functionality

Package trail provides audit trail loggers

Package trail provides audit trail management

Package trail provides audit trail utilities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatTimestamp added in v0.8.0

func FormatTimestamp(t time.Time) string

FormatTimestamp formats a timestamp for audit logs

func GenerateAuditID added in v0.8.0

func GenerateAuditID() (string, error)

GenerateAuditID generates a unique audit ID

func ValidateAuditLog added in v0.8.0

func ValidateAuditLog(log *AuditLog) error

ValidateAuditLog validates an audit log entry

Types

type AuditLog

type AuditLog struct {
	ID           string                 `json:"id"`
	Timestamp    time.Time              `json:"timestamp"`
	Operation    string                 `json:"operation"`
	ResourceType string                 `json:"resource_type"`
	ResourceID   string                 `json:"resource_id"`
	Description  string                 `json:"description"`
	Status       string                 `json:"status"`
	IPAddress    string                 `json:"ip_address"`
	Details      map[string]interface{} `json:"details"`
}

AuditLog represents an audit log entry

type AuditTrail added in v0.8.0

type AuditTrail struct {
	Writer io.Writer
	// contains filtered or unexported fields
}

AuditTrail manages audit logging

func NewAuditTrail added in v0.8.0

func NewAuditTrail(writer io.Writer) *AuditTrail

NewAuditTrail creates a new audit trail

func (*AuditTrail) Close added in v0.8.0

func (a *AuditTrail) Close() error

func (*AuditTrail) LogOperation added in v0.8.0

func (a *AuditTrail) LogOperation(ctx context.Context, log *AuditLog) error

LogOperation logs an operation to the audit trail

type FileLogger

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

FileLogger logs audit events to a file

func NewFileLogger

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

NewFileLogger creates a new file logger

func (*FileLogger) Close

func (f *FileLogger) Close() error

Close closes the log file

func (*FileLogger) Write added in v0.8.0

func (f *FileLogger) Write(data []byte) (int, error)

Write writes data to the log file

type Manager added in v0.8.0

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

Manager manages audit trail operations

func NewManager added in v0.8.0

func NewManager(logPath string) (*Manager, error)

NewManager creates a new audit trail manager

func (*Manager) Close added in v0.8.0

func (m *Manager) Close() error

Close closes the audit trail manager

func (*Manager) GetTrail added in v0.8.0

func (m *Manager) GetTrail() *AuditTrail

GetTrail returns the audit trail

func (*Manager) LogOperation added in v0.8.0

func (m *Manager) LogOperation(ctx context.Context, log *AuditLog) error

LogOperation logs an operation to the audit trail

type RotatingLogger added in v0.8.0

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

RotatingLogger provides log rotation functionality

func NewRotatingLogger added in v0.8.0

func NewRotatingLogger(basePath string, maxSize int64) *RotatingLogger

NewRotatingLogger creates a new rotating logger

func (*RotatingLogger) Close added in v0.8.0

func (r *RotatingLogger) Close() error

Close closes the current log file

func (*RotatingLogger) Write added in v0.8.0

func (r *RotatingLogger) Write(data []byte) (int, error)

Write writes data with automatic rotation

Jump to

Keyboard shortcuts

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