Documentation
¶
Index ¶
- func Close() error
- func Init()
- func InitWithConfig(config *LogConfig)
- func IsValidLogLevel(level string) bool
- func Log(service, subcomponent string, level LogLevel, message string, ...)
- func LogBusinessEvent(service, subcomponent string, event BusinessEvent, ...)
- func LogError(service, subcomponent string, err error, details ErrorDetails, ...)
- func LogHostDiscovery(scanID, hostIP string, ports []int, toolUsed string)
- func LogPerformanceMetric(service, subcomponent string, metric PerformanceMetric, ...)
- func LogScanCompletion(scanID, target string, metadata map[string]interface{})
- func LogScanError(scanID, target, errorCode, message string, err error)
- func LogScanEvent(scanID, eventType, message string, metadata map[string]interface{})
- func LogToolExecution(scanID, target, tool string, duration time.Duration, success bool, ...)
- func LogVulnerabilityScan(scanID, hostIP string, vulnerabilities []map[string]interface{}, ...)
- type BusinessEvent
- type ContextLogger
- type ErrorDetails
- type LogConfig
- type LogContext
- type LogEntry
- type LogLevel
- type LoggingClient
- func (lc *LoggingClient) Close() error
- func (lc *LoggingClient) Log(service, subcomponent string, level LogLevel, message string, ...)
- func (lc *LoggingClient) LogBusinessEvent(service, subcomponent string, event BusinessEvent, ...)
- func (lc *LoggingClient) LogError(service, subcomponent string, err error, details ErrorDetails, ...)
- func (lc *LoggingClient) LogHostDiscovery(scanID, hostIP string, ports []int, toolUsed string)
- func (lc *LoggingClient) LogPerformanceMetric(service, subcomponent string, metric PerformanceMetric, ...)
- func (lc *LoggingClient) LogScanCompletion(scanID, target string, metadata map[string]interface{})
- func (lc *LoggingClient) LogScanError(scanID, target, errorCode, message string, err error)
- func (lc *LoggingClient) LogScanEvent(scanID, eventType, message string, metadata map[string]interface{})
- func (lc *LoggingClient) LogToolExecution(scanID, target, tool string, duration time.Duration, success bool, ...)
- func (lc *LoggingClient) LogVulnerabilityScan(scanID, hostIP string, vulnerabilities []map[string]interface{}, ...)
- type PerformanceMetric
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitWithConfig ¶
func InitWithConfig(config *LogConfig)
InitWithConfig initializes the global logging client with custom configuration
func IsValidLogLevel ¶
IsValidLogLevel checks if a string represents a valid log level
func Log ¶
func Log(service, subcomponent string, level LogLevel, message string, metadata map[string]interface{}, context map[string]interface{})
Log sends a log entry using the global client
func LogBusinessEvent ¶
func LogBusinessEvent(service, subcomponent string, event BusinessEvent, metadata map[string]interface{})
LogBusinessEvent logs a business event using the global client
func LogError ¶
func LogError(service, subcomponent string, err error, details ErrorDetails, metadata map[string]interface{})
LogError logs an error using the global client
func LogHostDiscovery ¶
LogHostDiscovery logs host discovery using the global client
func LogPerformanceMetric ¶
func LogPerformanceMetric(service, subcomponent string, metric PerformanceMetric, metadata map[string]interface{})
LogPerformanceMetric logs a performance metric using the global client
func LogScanCompletion ¶
LogScanCompletion logs scan completion using the global client
func LogScanError ¶
LogScanError logs a scan error using the global client
func LogScanEvent ¶
LogScanEvent logs a scan event using the global client
func LogToolExecution ¶
func LogToolExecution(scanID, target, tool string, duration time.Duration, success bool, metadata map[string]interface{})
LogToolExecution logs tool execution using the global client
func LogVulnerabilityScan ¶
func LogVulnerabilityScan(scanID, hostIP string, vulnerabilities []map[string]interface{}, toolUsed string)
LogVulnerabilityScan logs vulnerability scan using the global client
Types ¶
type BusinessEvent ¶
type BusinessEvent struct { EventType string `json:"event_type"` EntityID string `json:"entity_id,omitempty"` EntityType string `json:"entity_type,omitempty"` Action string `json:"action,omitempty"` Result string `json:"result,omitempty"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
BusinessEvent represents a structured business event for logging
type ContextLogger ¶
type ContextLogger struct {
// contains filtered or unexported fields
}
ContextLogger provides context-aware logging
func WithContext ¶
func WithContext(ctx context.Context) *ContextLogger
WithContext creates a context-aware logger
func (*ContextLogger) Log ¶
func (cl *ContextLogger) Log(service, subcomponent string, level LogLevel, message string, metadata map[string]interface{}, context map[string]interface{})
Log sends a log entry with context
func (*ContextLogger) LogBusinessEvent ¶
func (cl *ContextLogger) LogBusinessEvent(service, subcomponent string, event BusinessEvent, metadata map[string]interface{})
LogBusinessEvent logs a business event with context
func (*ContextLogger) LogError ¶
func (cl *ContextLogger) LogError(service, subcomponent string, err error, details ErrorDetails, metadata map[string]interface{})
LogError logs an error with context
type ErrorDetails ¶
type ErrorDetails struct { ErrorCode string `json:"error_code,omitempty"` ErrorMessage string `json:"error_message"` StackTrace string `json:"stack_trace,omitempty"` Source string `json:"source,omitempty"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
ErrorDetails represents detailed error information for logging
type LogConfig ¶
type LogConfig struct { APIBaseURL string `json:"api_base_url"` Timeout time.Duration `json:"timeout"` MaxRetries int `json:"max_retries"` RetryDelay time.Duration `json:"retry_delay"` Async bool `json:"async"` BufferSize int `json:"buffer_size"` FlushInterval time.Duration `json:"flush_interval"` }
LogConfig represents configuration for the logging client
func DefaultLogConfig ¶
func DefaultLogConfig() *LogConfig
DefaultLogConfig returns a default configuration for logging
func LoadConfigFromEnv ¶
func LoadConfigFromEnv() *LogConfig
LoadConfigFromEnv loads logging configuration from environment variables
type LogContext ¶
type LogContext struct { Type string `json:"type,omitempty"` Endpoint string `json:"endpoint,omitempty"` Method string `json:"method,omitempty"` RequestID string `json:"request_id,omitempty"` UserID string `json:"user_id,omitempty"` SessionID string `json:"session_id,omitempty"` Custom map[string]interface{} `json:"custom,omitempty"` }
LogContext represents additional context for log entries
type LogEntry ¶
type LogEntry struct { ID string `json:"id"` Timestamp time.Time `json:"timestamp"` Service string `json:"service"` Subcomponent string `json:"subcomponent,omitempty"` Level LogLevel `json:"level"` Message string `json:"message"` Metadata map[string]interface{} `json:"metadata,omitempty"` Context map[string]interface{} `json:"context,omitempty"` }
LogEntry represents a structured log entry
type LogLevel ¶
type LogLevel string
LogLevel represents the severity level of a log entry
func GetLogLevelFromString ¶
GetLogLevelFromString converts a string to LogLevel
type LoggingClient ¶
type LoggingClient struct {
// contains filtered or unexported fields
}
LoggingClient provides a centralized way to send structured logs to the API
func GetClient ¶
func GetClient() *LoggingClient
GetClient returns the global logging client, initializing it if necessary
func NewLoggingClient ¶
func NewLoggingClient() *LoggingClient
NewLoggingClient creates a new LoggingClient instance with default configuration
func NewLoggingClientWithConfig ¶
func NewLoggingClientWithConfig(config *LogConfig) *LoggingClient
NewLoggingClientWithConfig creates a new LoggingClient instance with custom configuration
func (*LoggingClient) Close ¶
func (lc *LoggingClient) Close() error
Close gracefully shuts down the logging client
func (*LoggingClient) Log ¶
func (lc *LoggingClient) Log(service, subcomponent string, level LogLevel, message string, metadata map[string]interface{}, context map[string]interface{})
Log sends a generic log entry to the API
func (*LoggingClient) LogBusinessEvent ¶
func (lc *LoggingClient) LogBusinessEvent(service, subcomponent string, event BusinessEvent, metadata map[string]interface{})
LogBusinessEvent logs a structured business event
func (*LoggingClient) LogError ¶
func (lc *LoggingClient) LogError(service, subcomponent string, err error, details ErrorDetails, metadata map[string]interface{})
LogError logs an error with detailed information
func (*LoggingClient) LogHostDiscovery ¶
func (lc *LoggingClient) LogHostDiscovery(scanID, hostIP string, ports []int, toolUsed string)
LogHostDiscovery logs host discovery events (convenience method for App Scanner)
func (*LoggingClient) LogPerformanceMetric ¶
func (lc *LoggingClient) LogPerformanceMetric(service, subcomponent string, metric PerformanceMetric, metadata map[string]interface{})
LogPerformanceMetric logs a performance metric
func (*LoggingClient) LogScanCompletion ¶
func (lc *LoggingClient) LogScanCompletion(scanID, target string, metadata map[string]interface{})
LogScanCompletion logs scan completion (convenience method for App Scanner)
func (*LoggingClient) LogScanError ¶
func (lc *LoggingClient) LogScanError(scanID, target, errorCode, message string, err error)
LogScanError logs a scan-related error (convenience method for App Scanner)
func (*LoggingClient) LogScanEvent ¶
func (lc *LoggingClient) LogScanEvent(scanID, eventType, message string, metadata map[string]interface{})
LogScanEvent logs a scan-related event (convenience method for App Scanner)
func (*LoggingClient) LogToolExecution ¶
func (lc *LoggingClient) LogToolExecution(scanID, target, tool string, duration time.Duration, success bool, metadata map[string]interface{})
LogToolExecution logs tool execution metrics (convenience method for App Scanner)
func (*LoggingClient) LogVulnerabilityScan ¶
func (lc *LoggingClient) LogVulnerabilityScan(scanID, hostIP string, vulnerabilities []map[string]interface{}, toolUsed string)
LogVulnerabilityScan logs vulnerability scan results (convenience method for App Scanner)
type PerformanceMetric ¶
type PerformanceMetric struct { Duration time.Duration `json:"duration"` MemoryUsage int64 `json:"memory_usage,omitempty"` CPUUsage float64 `json:"cpu_usage,omitempty"` Throughput float64 `json:"throughput,omitempty"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
PerformanceMetric represents performance data for logging