Skip to content

streply/streply-monolog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Streply Monolog Handler

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