Documentation
¶
Index ¶
- type ContextualLogger
- func (l *ContextualLogger) LogBusinessEvent(ctx context.Context, event string, data map[string]interface{})
- func (l *ContextualLogger) LogDatabaseOperation(ctx context.Context, query string, duration time.Duration, rowsAffected int64)
- func (l *ContextualLogger) LogError(ctx context.Context, err error, message string, data map[string]interface{})
- func (l *ContextualLogger) LogExternalAPICall(ctx context.Context, service string, method string, url string, statusCode int, ...)
- func (l *ContextualLogger) LogPerformanceEvent(ctx context.Context, operation string, duration time.Duration, ...)
- func (l *ContextualLogger) LogSecurityEvent(ctx context.Context, event string, data map[string]interface{})
- func (l *ContextualLogger) WithContext(ctx context.Context) LoggerEntry
- func (l *ContextualLogger) WithCorrelation(correlationID string) LoggerEntry
- func (l *ContextualLogger) WithError(err error) LoggerEntry
- func (l *ContextualLogger) WithFields(fields map[string]interface{}) LoggerEntry
- func (l *ContextualLogger) WithOperation(operation string) LoggerEntry
- func (l *ContextualLogger) WithTenant(tenantID string) LoggerEntry
- func (l *ContextualLogger) WithUser(userID string) LoggerEntry
- type LogEntry
- type Logger
- type LoggerEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextualLogger ¶
ContextualLogger provides structured logging with context awareness
func (*ContextualLogger) LogBusinessEvent ¶
func (l *ContextualLogger) LogBusinessEvent(ctx context.Context, event string, data map[string]interface{})
Business operation methods
func (*ContextualLogger) LogDatabaseOperation ¶
func (*ContextualLogger) LogExternalAPICall ¶
func (*ContextualLogger) LogPerformanceEvent ¶
func (*ContextualLogger) LogSecurityEvent ¶
func (l *ContextualLogger) LogSecurityEvent(ctx context.Context, event string, data map[string]interface{})
func (*ContextualLogger) WithContext ¶
func (l *ContextualLogger) WithContext(ctx context.Context) LoggerEntry
WithContext creates a log entry with context information
func (*ContextualLogger) WithCorrelation ¶
func (l *ContextualLogger) WithCorrelation(correlationID string) LoggerEntry
WithCorrelation creates a log entry with correlation ID
func (*ContextualLogger) WithError ¶
func (l *ContextualLogger) WithError(err error) LoggerEntry
WithError creates a log entry with error information
func (*ContextualLogger) WithFields ¶
func (l *ContextualLogger) WithFields(fields map[string]interface{}) LoggerEntry
WithFields creates a log entry with multiple fields
func (*ContextualLogger) WithOperation ¶
func (l *ContextualLogger) WithOperation(operation string) LoggerEntry
WithOperation creates a log entry with operation information
func (*ContextualLogger) WithTenant ¶
func (l *ContextualLogger) WithTenant(tenantID string) LoggerEntry
WithTenant creates a log entry with tenant information
func (*ContextualLogger) WithUser ¶
func (l *ContextualLogger) WithUser(userID string) LoggerEntry
WithUser creates a log entry with user information
type LogEntry ¶
LogEntry represents a log entry with context
func (*LogEntry) WithContext ¶ added in v1.0.1
func (e *LogEntry) WithContext(ctx context.Context) LoggerEntry
Implement LoggerEntry interface methods for LogEntry
func (*LogEntry) WithError ¶ added in v1.0.1
func (e *LogEntry) WithError(err error) LoggerEntry
func (*LogEntry) WithField ¶ added in v1.0.1
func (e *LogEntry) WithField(key string, value interface{}) LoggerEntry
func (*LogEntry) WithFields ¶ added in v1.0.1
func (e *LogEntry) WithFields(fields map[string]interface{}) LoggerEntry
type Logger ¶
type Logger interface { // Context-aware logging WithContext(ctx context.Context) LoggerEntry WithTenant(tenantID string) LoggerEntry WithUser(userID string) LoggerEntry WithCorrelation(correlationID string) LoggerEntry WithOperation(operation string) LoggerEntry WithFields(fields map[string]interface{}) LoggerEntry WithError(err error) LoggerEntry // Business event logging LogBusinessEvent(ctx context.Context, event string, data map[string]interface{}) LogSecurityEvent(ctx context.Context, event string, data map[string]interface{}) LogPerformanceEvent(ctx context.Context, operation string, duration time.Duration, data map[string]interface{}) LogError(ctx context.Context, err error, message string, data map[string]interface{}) LogDatabaseOperation(ctx context.Context, query string, duration time.Duration, rowsAffected int64) LogExternalAPICall(ctx context.Context, service string, method string, url string, statusCode int, duration time.Duration) }
Logger defines the interface for contextual logging
type LoggerEntry ¶
type LoggerEntry interface { // Standard logging levels Debug(args ...interface{}) Info(args ...interface{}) Warn(args ...interface{}) Error(args ...interface{}) Fatal(args ...interface{}) Panic(args ...interface{}) // Formatted logging Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Warnf(format string, args ...interface{}) Errorf(format string, args ...interface{}) Fatalf(format string, args ...interface{}) Panicf(format string, args ...interface{}) // Context and field manipulation WithContext(ctx context.Context) LoggerEntry WithField(key string, value interface{}) LoggerEntry WithFields(fields map[string]interface{}) LoggerEntry WithError(err error) LoggerEntry }
LoggerEntry defines the interface for a log entry