PHP code example of itafroma / snaglogger

1. Go to this page and download the library: Download itafroma/snaglogger library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

itafroma / snaglogger example snippets


use Itafroma\Snaglogger\LoggerFactory;

$key    = 'YOUR BUGSNAG API KEY HERE';
$logger = LoggerFactory::create($key);

$logger->info('This is an informational message.');
$logger->error('This is an error.');

$message = 'The {location} is on fire!';
$context = ['location' => 'roof'];

// Bugsnag will record the error message as "The roof is on fire!"
$logger->error($message, $context);

$client = Client::make('API KEY')->setReleaseStage('prod');
$interpolator = new CustomMessageInterpolator();
$mapper = new CustomSeverityMapper();

$logger = new Logger($client, $interpolator, $mapper);