PHP code example of sakydev / monolog-httpapi
1. Go to this page and download the library: Download sakydev/monolog-httpapi 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/ */
sakydev / monolog-httpapi example snippets
use Monolog\Logger;
use sakydev\HttpApiHandler\HttpApiHandler;
$log = new Logger('HttpApiHandler');
$channel = 'default-channel';
$headers = ['Content-Type: application/json'];
$log->pushHandler(new HttpApiHandler('http://url-here.com', $channel, $headers));
$log->notice('hello world !');
$log->info('hello world !');
$log->debug('hello world !');
$log->warning('hello world !');
$log->critical('hello world !');
$log->alert('hello world !');
$log->emergency('hello world !');
$log->error('hello world !');
/**
* Optionally you can pass second paramater such as a object
**/
$log->info('user just logged in !',['user'=>$user]);