Logger

INEX SPA - Logger System Documentation


πŸ“ Feature: Logger System

INEX SPA includes a lightweight, powerful logging system that allows developers to log important events, errors, and security-related actions. It helps in debugging, monitoring, and maintaining the integrity of your application.


πŸ› οΈ Enable Logging

To enable the Logger system, open your .env file and set the following:

USE_LOGGING=true

Once enabled, you can use the Logger manually in your PHP code.


πŸ“ Files and Structure

  • Logger Class: /core/functions/PHP/classes/Logger.php

  • Logs Directory: /core/logs/

    • system.log

    • errors.log

    • security.log

    • api.log


βš™οΈ Logger Functions

➀ Logger::log($type, $message)

Logs a message with a specific type.

  • $type: One of the following:

    • system: For general events.

    • error: For errors and exceptions.

    • security: For unauthorized access, login attempts, etc.

    • api: For tracking API calls or integrations.

Example:


➀ Logger::clearLogs()

Clears the content of all log files.

Example:

πŸ”’ You can restrict access to clearLogs() usage in production.


πŸ“„ Log Format

Each entry is recorded like this:

Example:


βœ… Status

βœ… Lightweight βœ… Easy to configure βœ… Extensible βœ… No external libraries


Β© INEX SPA Team - Logger System

Last updated