πͺ΅ Logs
Overview
The TGG Banking system automatically logs all important banking activities to your database. These logs can be used for auditing, debugging, and tracking player actions. The logging system is built-in and requires no additional configuration - logs are automatically created when banking operations occur.
Features
- Automatic Logging: All banking operations are automatically logged
- Database Storage: Logs are stored in the
tgg_banking_logsdatabase table - Event Integration: Logs trigger server events for external integrations
- Discord Webhook Support: Built-in Discord webhook integration via custom file
- Comprehensive Coverage: Tracks accounts, cards, transactions, and loans
- Player Tracking: All logs include player identifiers and IBANs
- Batch Processing: Logs are queued and sent in batches for efficiency
Configuration
Discord Webhook Setup
The banking system includes a built-in Discord webhook integration. To enable it:
-
Create a Discord Webhook:
- Go to your Discord server settings
- Navigate to Integrations β Webhooks
- Create a new webhook and copy the webhook URL
-
Add the Convar to
server.cfg:Code -
Restart the Resource:
bash
Custom Logs Configuration
The logging system uses server/custom/logs.lua for Discord webhook integration. You can customize this file:
Excluding Log Types
To prevent certain log types from being sent to Discord, edit server/custom/logs.lua:
Adjusting Batch Timeout
By default, logs are sent every 10 seconds if the queue hasn't reached 10 logs. To change this:
Batch Size
Logs are automatically sent when 10 logs are queued for the same IBAN. This is hardcoded in the file but can be modified:
Log Types
The banking system uses predefined log types. Here are all available log types:
Account Operations
Account Members
Transactions
Card Operations
Loan Operations
Savings Accounts
Custom Logs
Server Event Integration
When a log is created, the system automatically triggers a server event that can be used for external integrations (Discord webhooks, logging systems, etc.):
Event Parameters
iban(string): The IBAN of the account related to the logplayerId(string): The identifier of the player who performed the actionlogType(string): The type of log (from LogType enum)logMessage(string): A descriptive message about what happened
Custom Event Handler
If you want to create your own logging system instead of using the built-in server/custom/logs.lua, you can listen to the event: