Logger Edit

πŸ“‹ Overview

The logger module provides a flexible way to integrate custom logging functionality. Located in editable/server/logger.lua, this module handles both server-side logging and Discord webhook integration.

πŸ”§ Core Functions

Basic Logging

--- Log an event to the server
--- @param src number|string Source of the event (player id or "SYSTEM")
--- @param event string Event name/type
--- @param message any Message or data to log
EditableLogger.log(src, event, message)

Discord Webhook Integration

--- Send a log to Discord webhook
--- @param data table Webhook data structure
EditableLogger.logDiscord(data)

πŸ“Š Data Structures

Discord Webhook Data

{
    type = 'putPhone',              -- Event type
    title = 'CHARGING KIOSK',       -- Embed title
    action = 'Phone Stored',        -- Action description
    stationId = 'station_1',        -- Station identifier
    kioskId = 'kiosk_1',           -- Kiosk identifier
    phoneNumber = '555-0123',       -- Phone number
    battery = 50,                   -- Battery level
    amount = 100,                   -- Transaction amount
    playerInfo = {                  -- Player information
        source = 1,
        license = 'license:xxx',
        discord = '<@discordid>'
    }
}

βš™οΈ Customization Tips

Adding New Log Types

  1. Add webhook URL in configuration

  2. Define color code

  3. Create log format

  4. Implement logging call

πŸ› οΈ Error Handling

  • Always check webhook URLs validity

  • Handle missing configuration gracefully

  • Validate data structures before logging

  • Implement fallback logging methods


Integrated by Sahara Scripters - Making logs more interesting than your server chat

Last updated