logging

package
v0.0.6-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const (
	LevelTrace    = slog.Level(-8)
	LevelFatal    = slog.Level(12)
	LevelSecurity = slog.Level(16)

	SeverityLow      = "Low"
	SeverityMedium   = "Medium"
	SeverityHigh     = "High"
	SeverityCritical = "Critical"

	CategoryAccessControl    = "Access Control"
	CategoryAuthentication   = "Authentication"
	CategoryAuthorization    = "Authorization"
	CategoryDataBreach       = "Data Breach"
	CategoryMalwareDetection = "Malware Detection"
	CategoryNetworkSecurity  = "Network Security"
	CategoryPolicyViolation  = "Policy Violation"
	CategorySystemIntegrity  = "System Integrity"
	CategoryUserBehavior     = "User Behavior"

	SourceAccessControl  = "access_control"
	SourceAuthentication = "authentication"
	SourceDNS            = "dns"
	SourceNetwork        = "network"
	SourceSystem         = "system"
	SourceUserActivity   = "user_activity"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

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

func DefaultLogger

func DefaultLogger() *Logger

func NewLogger

func NewLogger(level slog.Level, logFile afero.File) *Logger

func (*Logger) Debug

func (l *Logger) Debug(message string, args ...any)

Debug

func (*Logger) Debugf

func (l *Logger) Debugf(message string, args ...any)

func (*Logger) Error

func (l *Logger) Error(err error, args ...any)

Error

func (*Logger) Errorf

func (l *Logger) Errorf(message string, args ...any)

func (*Logger) Fatal

func (l *Logger) Fatal(message string, args ...any)

Fatal

func (*Logger) FatalError

func (l *Logger) FatalError(err error)

func (*Logger) Fatalf

func (l *Logger) Fatalf(message string, args ...any)

func (*Logger) Info

func (l *Logger) Info(message string, args ...any)

Info

func (*Logger) Infof

func (l *Logger) Infof(message string, args ...any)

func (*Logger) MaybeError

func (l *Logger) MaybeError(err error, args ...any)

func (*Logger) Security

func (l *Logger) Security(issue SecurityLogEntry)

Logs a security issue with standardized fields to faciliate processing security issues by external systems.

func (*Logger) Warn

func (l *Logger) Warn(message string, args ...any)

Warn

func (*Logger) Warnf

func (l *Logger) Warnf(message string, args ...any)

type SecurityLogEntry

type SecurityLogEntry struct {
	Timestamp       time.Time `json:"timestamp"`
	Severity        string    `json:"severity"`
	Category        string    `json:"category"`
	Description     string    `json:"description"`
	Details         string    `json:"details,omitempty"`
	Source          string    `json:"source,omitempty"`
	OffenderAddress string    `json:"offender_address,omitempty"`
	OffenderID      string    `json:"offender_id,omitempty"`
}

SecurityLogEntry defines the structure of a security log entry.

Jump to

Keyboard shortcuts

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