streply/streply-monolog

Streply Monolog Handler

0.3 2024-02-05 21:51 UTC

This package is auto-updated.

Last update: 2024-12-05 23:48:33 UTC


README

Install

Use composer to install Streply Monolog Handler.

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

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.

Start logging

Use Monolog as always :)

<?php

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

Need help?

Please let us know at support@streply.com