PHP code example of chadicus / psr-log-mongodb
1. Go to this page and download the library: Download chadicus/psr-log-mongodb 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/ */
chadicus / psr-log-mongodb example snippets
use SubjectivePHP\Psr\Log\MongoLogger;
use MongoDB\Client;
$collection = (new Client())->selectDatabase('testing')->selectCollection('logs');
$logger = new MongoLogger($collection);
$logger->debug('Some debug info');
use SubjectivePHP\Psr\Log\MongoLogger;
use MongoDB\Client;
$collection = (new Client())->selectDatabase('testing')->selectCollection('logs');
$logger = new MongoLogger($collection);
$logger->info('User {username} was created', ['username' => 'chadicus']);