Log Levels
The Logger supports 6 log levels with increasing severity:Method Signature
Parameters:Logging Methods
Info
Log informational message. Example:Warn
Log warning message. Example:Error
Log error message. Example:Critical
Log critical failure. Example:Trace
Log detailed debugging information. Example:Log (Legacy)
General logging (retained for backward compatibility). Example:Log() method is legacy. Use Info(), Warn(), Error(), etc. instead for proper log level categorization.Output Flags
Theflags parameter controls where logs are output:
Console Output
- Controlled by
Convar.LOGGING.value - Only logs >= this level will print to console
- Configured in server.cfg
File Output
Files are organized by component name and date. New file created daily.
Discord Output
Discord logging only fires when
GlobalState.IsProduction is true AND the log level meets the minimum threshold (Convar.LOGGING.value). It will not send webhooks in development mode.trace- Grayinfo- Bluesuccess- Greenwarning- Yellowerror- Redcritical- Bright Red
Database Output
- Collection:
logs - Only in production environment
- Must pass
dataparameter for context
Complete Examples
Basic Logging
Player Action Logging
Anti-Cheat Detection
Best Practices
Choose Appropriate Log Levels
Choose Appropriate Log Levels
Use the right level for the right situation:
Include Relevant Context
Include Relevant Context
Always pass data parameter for important logs:
Don't Spam Console
Don't Spam Console
Use file logging for high-frequency logs:
Next Steps
Core - Fetch
Player and character data access
Core - Database
Database operations
Configuration
Server configuration
Middleware
Event middleware system