Documentation
¶
Index ¶
- type Config
- type Entry
- type Level
- type Logger
- func (l *Logger) Clear()
- func (l *Logger) Error(action, userID, clientIP, message string, success bool, ...)
- func (l *Logger) ExportJSON() ([]byte, error)
- func (l *Logger) ExportJSONToFile(path string) error
- func (l *Logger) GetEntries() []Entry
- func (l *Logger) GetEntriesBySession(sessionID string) []Entry
- func (l *Logger) GetEntriesByUser(userID string) []Entry
- func (l *Logger) GetLogs() []*Entry
- func (l *Logger) Info(action, userID, clientIP, message string, details map[string]interface{})
- func (l *Logger) Log(entry Entry)
- func (l *Logger) LogRequest(action, userID, clientIP, sessionID, requestID string, success bool, ...)
- func (l *Logger) Size() int
- func (l *Logger) Warn(action, userID, clientIP, message string, details map[string]interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Console bool // Log to console in addition to file
MaxEntries int // Maximum entries to keep in memory (0 = unlimited)
}
Config holds logger configuration
type Entry ¶
type Entry struct {
Timestamp time.Time `json:"timestamp"`
Level Level `json:"level"`
Action string `json:"action"`
UserID string `json:"user_id,omitempty"`
ClientIP string `json:"client_ip,omitempty"`
SessionID string `json:"session_id,omitempty"`
RequestID string `json:"request_id,omitempty"`
Success bool `json:"success"`
Message string `json:"message,omitempty"`
Details map[string]interface{} `json:"details,omitempty"`
DurationMs int64 `json:"duration_ms,omitempty"`
}
Entry represents an audit log entry
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger handles audit logging
func (*Logger) Error ¶
func (l *Logger) Error(action, userID, clientIP, message string, success bool, details map[string]interface{})
Error logs an error level entry
func (*Logger) ExportJSON ¶
ExportJSON exports all entries as JSON
func (*Logger) ExportJSONToFile ¶
ExportJSONToFile exports entries to a file
func (*Logger) GetEntries ¶
GetEntries returns all audit entries
func (*Logger) GetEntriesBySession ¶
GetEntriesBySession returns entries for a specific session
func (*Logger) GetEntriesByUser ¶
GetEntriesByUser returns entries for a specific user
Click to show internal directories.
Click to hide internal directories.