Administration - Logs¶
This page documents hooks in the administration - logs category.
CanPlayerSeeLogCategory(client, category)View Source
Purpose
Determines whether a player is allowed to see a specific translated log category.
Category
Administration - Logs
Realm
Shared
Parameters
Player client The player whose category visibility should be checked.
string category The translated log category name being evaluated.
Returns
boolean|nil Return false to hide the category from the player.
Example Usage
hook.Add("CanPlayerSeeLogCategory", "liaExampleCanPlayerSeeLogCategory", function(client, category)
if IsValid(client) and client:IsAdmin() then
return true
end
end)
CanPlayerSeeLogs(client)View Source
Purpose
Determines whether a player is allowed to receive and view server log entries.
Category
Administration - Logs
Realm
Server
Parameters
Player client The player whose log-viewing permission should be checked.
Returns
boolean True if admin console log networking is enabled and the player has the canSeeLogs privilege.
Example Usage
hook.Add("CanPlayerSeeLogs", "liaExampleCanPlayerSeeLogs", function(client)
return true
end)
CreateLogsUI(panel, categories)View Source
Purpose
Builds or refreshes the clientside log viewer interface for the admin panel.
Category
Administration - Logs
Realm
Client
Parameters
Panel panel The parent panel that should contain the logs UI.
table categories The ordered list of translated log categories to show as tabs.
Example Usage
hook.Add("CreateLogsUI", "liaExampleCreateLogsUI", function(panel, categories)
categories[#categories + 1] = {
category = "custom",
name = "Custom Logs"
}
end)
OnServerLog(client, logType, logString, category)View Source
Purpose
Called whenever a server log entry is created through lia.log.add.
Category
Administration - Logs
Realm
Server
Parameters
Player client The player associated with the log entry. May be invalid or nil for console/system logs.
string logType The internal log type identifier used to generate the log message.
string logString The final formatted log message.
string category The translated category name assigned to the log entry.
Example Usage
hook.Add("OnServerLog", "liaExampleOnServerLog", function(client, logType, logString, category)
if not IsValid(client) or logString == "" then return end
print(string.format("[MyModule] %s: %s", client:Name(), logString))
end)
ReadLogEntries(category, page)View Source
Purpose
Loads a page of stored log rows for a translated log category.
Category
Administration - Logs
Realm
Server
Parameters
string category The translated log category to read from storage.
number page The one-based page number to fetch.
Returns
Deferred Resolves with a table containing the page of log rows and pagination metadata.
Example Usage
hook.Add("ReadLogEntries", "liaExampleReadLogEntries", function(category, page)
print("[MyModule] handled ReadLogEntries")
end)