🏜️
Sahara Scripters
  • Welcome
    • Introduction
    • Community & Support
  • Premium Scripts
    • Charging Kiosk
      • Setup Guide
      • Configuration
      • Features
        • Charging System
        • Security
        • Rate Limiting
        • Logging System
        • Phones Management
        • Discord Integration
        • Target System
        • Blip System
        • Translations
      • Integration
        • Inventory Systems
        • Framework Migration
        • Logger Edit
      • Best Practices
      • Troubleshooting
      • Version History
  • Free Scripts
    • Elevator System
      • Setup & Configuration
      • Features Overview
      • Example Buildings
      • Troubleshooting
    • NPWD Renewed Weather APP
    • NPWD QBX Services APP
Powered by GitBook
On this page
  • 📋 Overview
  • 🔧 Core Functions
  • Basic Logging
  • Discord Webhook Integration
  • 📊 Data Structures
  • Discord Webhook Data
  • ⚙️ Customization Tips
  • Adding New Log Types
  • 🛠️ Error Handling
  1. Premium Scripts
  2. Charging Kiosk
  3. Integration

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

PreviousFramework MigrationNextBest Practices

Last updated 4 months ago