servdebt / sishandler
There is no license information available for the latest version (1.3.0) of this package.
This package's canonical repository appears to be gone and the package has been frozen as a result. Email us for help if needed.
1.3.0
2022-06-20 14:39 UTC
Requires
- ext-curl: *
- ext-json: *
- monolog/monolog: 2.7.*
README
Allows ServDebt systems to dispatch logs to the ServDebt Improvement System API using Monolog.
Require the package
composer require servdebt/sishandler
Usage Example
You can have a look at the included example.php file or:
use Monolog\Logger;
use Monolog\Processor\IntrospectionProcessor;
use Monolog\Handler\SISHandler;
// Adjust your settings
$apiKey = "SISAPIKey";
$apiUrl = "SISServerURL/api/logs";
// Create a log channel
$log = new Logger("ExampleChannel");
$log->pushHandler(new SISHandler($apiUrl, $apiKey));
// Optionally add IntrospectionProcessor to get the file path and line number where the log was generated
$log->pushProcessor(new IntrospectionProcessor());
// Build an array with your own error data
$data = [
"_id" => "5bd983a152b659e726378bd1",
"index" => 0,
"guid" => "486010d2-8e64-452c-990a-8b59a608572a",
"isActive" => true
];
// Dispatch the log
$log->warning("You error description", $data);