Use composer to install Streply Monolog Handler.
composer require streply/streply-monolog
Set up Monolog logger with Streply.
<?php
require __DIR__ . "/vendor/autoload.php";
use Monolog\Logger;
use Streply\Monolog\StreplyMonologHandler;
$logger = new Logger("example-app");
$logger->pushHandler(
new StreplyMonologHandler(
"https://clientPublicKey@api.streply.com/projectId"
)
);
You can find the DSN code of the project in the projects tab in your Streply account.
As a second parameter, you can set an array with optional parameters.
<?php
$logger->pushHandler(
new StreplyMonologHandler(
"https://clientPublicKey@api.streply.com/projectId",
[
'environment' => 'production',
'release' => 'my-project-name@2.3.12',
]
)
);
For more configuration options, see the Configuration tab.
Use Monolog as always :)
<?php
$logger->error("Some error here");
$logger->info("Some user logged in", [
'userName' => 'Joey'
]);
$logger->debug($sqlQuery);
Please let us know at support@streply.com