Logger
Comprehensive logging and audit trail system for the Lilia framework.
Overview
The logger library provides comprehensive logging functionality for the Lilia framework, enabling detailed tracking and recording of player actions, administrative activities, and system events. It operates on the server side and automatically categorizes log entries into predefined categories such as character management, combat, world interactions, chat communications, item transactions, administrative actions, and security events. The library stores all log entries in a database table with timestamps, player information, and categorized messages. It supports dynamic log type registration and provides hooks for external systems to process log events. The logger ensures accountability and provides administrators with detailed audit trails for server management and moderation.
lia.log.addType(logType, func, category)
Purpose
Register a new log type with formatter and category.
When Called
During init to add custom audit events (e.g., quests, crafting).
Parameters
string logType Unique log key.
function func Formatter function (client, ... ) -> string.
string category Category label used in console output and DB.
Example Usage
lia.log.addType("questComplete", function(client, questID, reward)
return L("logQuestComplete", client:Name(), questID, reward)
end, L("quests"))
lia.log.getString(client, logType)
Purpose
Build a formatted log string and return its category.
When Called
Internally by lia.log.add before printing/persisting logs.
Parameters
Returns
string|nil, string|nil logString, category
Example Usage
local text, category = lia.log.getString(ply, "playerDeath", attackerName)
if text then print(category, text) end