FireLogEvent
This function triggers an event used to track errors and warnings experienced by players.
For example, it could be called to indicate when a function call fails - such as a datastore save or TeleportService/Teleport
. See the example below.
Limits of events
Each game server is allowed a certain number of standard events API calls based on the number of players present (more players means more events will be needed).
The events that exceed the limit will be dropped and log an error to the developer console.
- Per minute limit: 120 + numPlayers * 20, all events shared this limit.
- Cooldown: refresh every 10 seconds
Limits of parameters
Limit the size of parameters. The event that exceeds the limit will be dropped and log an error to the developer console.
Parameters | Maximum Number of Characters |
---|---|
FireLogEvent stackTrace | 1000 |
FireLogEvent message | 500 |
customData Variant | 500 after serialized |
other string types | 50 |
See also
AnalyticsService/FireInGameEconomyEvent
, triggers an event used to track player actions pertaining to the in-game economyAnalyticsService/FirePlayerProgressionEvent
, triggers an event used to track player progression through the gameAnalyticsService/FireCustomEvent
, triggers an event used to emit a custom event
Parameters
Name | Type | Default | Description |
---|---|---|---|
|
The player who triggered the error event, nil if not player related |
||
|
The specified log level (e.g. Debug, Error) |
||
|
User defined message |
||
|
Optional. A dictionary which contains predefined keys including “errorCode” and “stackTrace”. Both keys values are strings. stackTrace is a traceback of the current function call stack local debugInfo = { errorCode = '123', stackTrace = debug.traceback() } |
||
|
Optional. User defined data, could be a string, a number or a table |
Returns
Return Type | Summary |
---|---|
No return |
Code Samples
Analytics Event - Log
The code sample below demonstrates how to use the `` function to track log events using the AnalyticsService
. The example uses the function to report when a TeleportService/Teleport
call fails.
local player = game.Players:GetPlayerByUserId(123) local placeId = greatPlaceId local TeleportService = game:GetService(“TeleportService”) local AnalyticsService = game:GetService(“AnalyticsService”) xpcall(function() TeleportService:Teleport(placeId, player) end, function(errorMsg) local debugInfo = { errorCode = 'TeleportFailed', stackTrace = debug.traceback() -- the function call stack } AnalyticsService:FireLogEvent( player, Enum.AnalyticsLogLevel.Error, -- log level errorMsg, -- message debugInfo, -- optional { PlayerId = player.UserId, PlaceId = placeId}) -- customData optional end)