The Half-Life Unified SDK uses spdlog to handle logging across all new systems. Every named logger can have its log level configured independently, output can be directed to a rotating daily log file, and because the logging system is implemented at the SDK level — not inside the engine — separate instances run for the client and the server. All console commands are therefore prefixed with eitherDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/twhl-community/halflife-unified-sdk/llms.txt
Use this file to discover all available pages before exploring further.
cl_ or sv_ to disambiguate which side they target.
Output Formats
Log messages are written to two destinations: the in-game console and, optionally, a log file on disk. Console output identifies the library side, the logger, and the level:short_library_prefix is cl for the client and sv for the server.
File output replaces the library prefix with a full timestamp:
logs/<short_library_prefix>/. The filename follows this pattern:
BaseFileName set to Unified on the server side, today’s log file would be named Unified_2024_06_02.log inside logs/sv/.
Log Levels
Levels run from most verbose to least verbose. Setting a logger to a given level enables that level and everything less verbose than it. Setting a logger tooff silences it entirely.
| Level | Description |
|---|---|
trace | Extremely detailed diagnostic output |
debug | Debug-build diagnostic output |
info | Normal operational messages |
warning | Conditions that may indicate a problem |
error | Errors that affect functionality |
critical | Severe errors (used by the assert logger in debug builds) |
off | No output |
List of Loggers
The logging system itself uses the logger namedlogging. All other named loggers are listed below.
| Name | Purpose |
|---|---|
angelscript | AngelScript scripting support |
assert | In debug builds, logs debug assertion messages at the critical level |
bot | Bot system |
conditional_evaluation | AngelScript conditional evaluation |
cvar | Console command system |
ent | General entity info |
ent.ai | NPC info |
ent.ai.script | NPC scripted behavior (scripted_sequence, aiscripted_sequence, scripted_sentence) |
ent.classify | Entity classifications |
ent.io | Entity I/O related to target and killtarget |
ent.template | Entity templates |
ent.weapons | Weapon state info |
game | General game events related to map loading and initialization |
gamecfg | Game configuration system |
gamerules | Game mode events, including output previously routed to the server log file |
json | JSON system |
logging | The logging system itself |
mapcycle | Map cycle |
materials | Material system |
net_data | Network data system |
nodegraph | Node graph debug output — produces heavy output at trace level |
precache | Every call to model, sound, and generic precache functions (engine-precached assets are not included) |
replacementmap | Replacement map system |
saverestore | Errors that occur during saving and loading |
sentences | Diagnostics, warnings, and errors during sentences.json file loading |
skill | Skill configuration system |
sound | Diagnostics, warnings, and errors during sound playback |
sound.cache | Client-side sound cache |
sound.sentences | Client-side sentences system |
ui | Client-side user interface systems |
ui.campaign | Campaign selection system |
voice | Server-side voice system |
Error Handling
If spdlog itself encounters an internal error, a message is printed to the console in this form:Configuration File
Logger settings are loaded fromcfg/logging.json, a JSON file that configures log levels for individual loggers and controls file logging.
Keys
Reset (boolean)
Reset (boolean)
If
true, all previous settings — including those set on the command line — are reset to their defaults before the rest of the configuration is applied.Defaults (object)
Defaults (object)
Default values applied to every logger unless overridden by a
LoggerConfigurations entry.| Key | Type | Purpose |
|---|---|---|
LogLevel | string | Default log level for all loggers |
LoggerConfigurations (array)
LoggerConfigurations (array)
A list of per-logger configuration objects.
| Key | Type | Purpose |
|---|---|---|
Name | string | The name of the logger (use log_listloggers to see all names) |
LogLevel | string | The log level for this specific logger |
LogFile (object)
LogFile (object)
Controls file logging behaviour.
| Key | Type | Purpose |
|---|---|---|
Enabled | boolean | Whether file logging is active |
BaseFileName | string | Base name for the log file. Defaults to L |
MaxFiles | integer | Maximum number of contiguous daily log files to keep before older files are deleted |
Example Configuration
info, and disables file logging.
Console Commands
All commands exist in both a client-prefixed (cl_) and a server-prefixed (sv_) form. For example, sv_log_listloggers and cl_log_listloggers are both valid.
| Command | Syntax | Description |
|---|---|---|
log_listloglevels | log_listloglevels | Prints all available log levels from most to least verbose |
log_listloggers | log_listloggers | Prints all registered logger names |
log_setlevel | log_setlevel <logger_name> [log_level] | With only a name: prints the current level. With a level: sets the logger to that level |
log_setalllevels | log_setalllevels <log_level> | Sets all loggers to the given level |
log_setentlevels | log_setentlevels <log_level> | Sets all ent.* loggers plus nodegraph, saverestore, gamerules, and voice to the given level — equivalent to the developer cvar’s effect on logging |
log_file | log_file <on | off> | Without arguments: prints the current file-logging state. With on or off: enables or disables file logging |
Command Line Parameters
These parameters are evaluated at startup beforecfg/logging.json is loaded. The configuration file will override them.
-log_startup_level
developer cvar: debug if developer is greater than zero, otherwise info. The only way to set developer this early is with the -dev command line parameter.