Documentation
¶
Index ¶
- Constants
- func Debug(category string, format string, args ...interface{})
- func Error(category string, format string, args ...interface{})
- func Fatal(category string, format string, args ...interface{})
- func GetAllCategories() []string
- func Info(category string, format string, args ...interface{})
- func IsCategoryEnabled(category string) bool
- func IsGlobalEnabled() bool
- func IsStdoutEnabled() bool
- func SetCategoryEnabled(category string, enabled bool)
- func SetGlobalEnabled(enabled bool)
- func SetStdoutEnabled(enabled bool)
- func Warn(category string, format string, args ...interface{})
- type Entry
- type EntryBatch
- type LogLevel
- type Logger
- func (l *Logger) Debug(category string, format string, args ...interface{})
- func (l *Logger) EntriesAfter(cursor uint64, limit int) EntryBatch
- func (l *Logger) Error(category string, format string, args ...interface{})
- func (l *Logger) Fatal(category string, format string, args ...interface{})
- func (l *Logger) GetCategoryStates() map[string]bool
- func (l *Logger) GetMinLevel() LogLevel
- func (l *Logger) Info(category string, format string, args ...interface{})
- func (l *Logger) IsCategoryEnabled(category string) bool
- func (l *Logger) IsEnabled() bool
- func (l *Logger) IsStdoutEnabled() bool
- func (l *Logger) LoadConfigurationFromMap(config map[string]interface{})
- func (l *Logger) Log(level LogLevel, category string, format string, args ...interface{})
- func (l *Logger) SaveConfigurationToMap() map[string]interface{}
- func (l *Logger) SetCategoryEnabled(category string, enabled bool)
- func (l *Logger) SetCategoryStates(states map[string]bool)
- func (l *Logger) SetEnabled(enabled bool)
- func (l *Logger) SetMinLevel(level LogLevel)
- func (l *Logger) SetStdoutEnabled(enabled bool)
- func (l *Logger) Warn(category string, format string, args ...interface{})
Constants ¶
const ( // CategoryMoongate for moongate system logs (rendering, animation, travel) CategoryMoongate = "moongate" // CategoryConversation for semantic NPC conversation processing CategoryConversation = "conversation" // CategoryAI for NPC AI, pathfinding, and behavior logs CategoryAI = "ai" // CategoryAudio for audio system, music, and sound effect logs CategoryAudio = "audio" // CategoryConfig for configuration loading and validation logs CategoryConfig = "config" // CategoryUI for user interface, widgets, and dialog logs CategoryUI = "ui" // CategoryGameState for game state management and save/load operations CategoryGameState = "gamestate" // CategoryCombat for combat system and battle mechanics CategoryCombat = "combat" // CategoryMovement for player and NPC movement, collision detection CategoryMovement = "movement" // CategoryInventory for inventory management and item operations CategoryInventory = "inventory" // CategorySprites for sprite loading, animation, and rendering CategorySprites = "sprites" // CategorySystem for low-level system operations and initialization CategorySystem = "system" // CategoryData for data loading, parsing, and reference management CategoryData = "data" // CategoryInput for input handling and user commands CategoryInput = "input" // CategoryRendering for rendering, graphics, and visual effects CategoryRendering = "rendering" // CategoryValidation for validation, bounds checking, and integrity checks CategoryValidation = "validation" // CategoryPerformance for performance monitoring and profiling CategoryPerformance = "performance" // CategoryLighthouse for lighthouse rotation and lighting system CategoryLighthouse = "lighthouse" )
LogCategory constants for consistent categorization across the codebase These categories help organize and filter log messages by functional area
Variables ¶
This section is empty.
Functions ¶
func GetAllCategories ¶
func GetAllCategories() []string
GetAllCategories returns all available log categories for configuration UI
func IsCategoryEnabled ¶
IsCategoryEnabled checks if a category is enabled
func IsGlobalEnabled ¶
func IsGlobalEnabled() bool
IsGlobalEnabled returns the global logging enabled state
func SetCategoryEnabled ¶
SetCategoryEnabled sets a category's enabled state
func SetGlobalEnabled ¶
func SetGlobalEnabled(enabled bool)
SetGlobalEnabled sets the global logging enabled state
func SetStdoutEnabled ¶
func SetStdoutEnabled(enabled bool)
SetStdoutEnabled sets stdout logging state
Types ¶
type Entry ¶
type Entry struct {
Sequence uint64 `json:"sequence"`
Timestamp time.Time `json:"timestamp"`
Level string `json:"level"`
Category string `json:"category"`
Message string `json:"message"`
}
Entry is one structured categorized log record retained for diagnostics.
type EntryBatch ¶
type EntryBatch struct {
Entries []Entry `json:"entries"`
NextCursor uint64 `json:"nextCursor"`
OldestSequence uint64 `json:"oldestSequence"`
NewestSequence uint64 `json:"newestSequence"`
Dropped uint64 `json:"dropped"`
HasMore bool `json:"hasMore"`
}
EntryBatch is an independent cursor snapshot from the bounded log buffer.
type LogLevel ¶
type LogLevel int
LogLevel represents the importance/severity of a log message
const ( // DEBUG level for detailed diagnostic information, typically only visible during development DEBUG LogLevel = iota // INFO level for general informational messages that highlight application progress INFO // WARN level for potentially harmful situations that don't prevent operation WARN // ERROR level for error events that still allow the application to continue ERROR // FATAL level for severe error events that will likely abort the application FATAL )
func ParseLogLevel ¶
ParseLogLevel converts a string to a LogLevel
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is the main logging interface that handles categorized, leveled logging
func GetGlobalLogger ¶
func GetGlobalLogger() *Logger
GetGlobalLogger returns the global logger instance
func NewLogger ¶
func NewLogger() *Logger
NewLogger creates a new logger instance with default settings
func (*Logger) EntriesAfter ¶
func (l *Logger) EntriesAfter(cursor uint64, limit int) EntryBatch
EntriesAfter returns copied records newer than cursor without advancing other readers.
func (*Logger) GetCategoryStates ¶
GetCategoryStates returns the current state of all categories for saving
func (*Logger) GetMinLevel ¶
GetMinLevel returns the current minimum log level
func (*Logger) IsCategoryEnabled ¶
IsCategoryEnabled returns whether a specific category is enabled
func (*Logger) IsStdoutEnabled ¶
IsStdoutEnabled returns whether stdout logging is enabled
func (*Logger) LoadConfigurationFromMap ¶
LoadConfigurationFromMap loads logging settings from a configuration map
func (*Logger) SaveConfigurationToMap ¶
SaveConfigurationToMap saves current logging settings to a configuration map
func (*Logger) SetCategoryEnabled ¶
SetCategoryEnabled sets the enabled state for a specific category
func (*Logger) SetCategoryStates ¶
SetCategoryStates sets the state of all categories (for loading from config)
func (*Logger) SetEnabled ¶
SetEnabled sets the global logging enabled state
func (*Logger) SetMinLevel ¶
SetMinLevel sets the minimum log level to output
func (*Logger) SetStdoutEnabled ¶
SetStdoutEnabled sets whether logs should be output to stdout