xray-log/php-sdk

XRay Log PHP SDK for logging and monitoring

v1.3.0 2024-12-23 19:10 UTC

This package is auto-updated.

Last update: 2024-12-23 19:11:16 UTC


README

XRay Log PHP SDK for logging and monitoring applications. This SDK provides a simple way to log various data types with type preservation.

Build Status Total Downloads Latest Stable Version License

Installation

You can install the package via composer:

composer require xray-log/php-sdk

Usage

Using Logger Class

use XRayLog\XRayLogger;

// Initialize logger
$logger = new XRayLogger('Your Project Name');

// Log messages
$logger->info("User logged in");
$logger->error("Something went wrong");
$logger->debug(['user_id' => 1, 'status' => 'active']);

Using Helper Function

// Set project name (optional)
xray_setup(['project' => 'My Project']);

// Log with default INFO level
xray("Simple message");

// Log with specific level
xray('error', "Something went wrong");
xray('debug', ['user_id' => 1]);

Testing

composer test

License

The XRay Log PHP SDK is open-sourced software licensed under the MIT license.