Skip to main content

Monolog

Streply Monolog Handler.

Install

The first step is to download the streply/streply-monolog package using the composer.

composer require streply/streply-monolog

Setup

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"
)
);

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.

info

You can find the DSN code of the project in the Projects tab of your Streply account.

Start logging

Use Monolog as always :)

PHP
$logger->error("Some error here");
$logger->info("Some user logged in", [
'userName' => 'Joey'
]);
$logger->debug($sqlQuery);