PHP code example of jkey / monolog-mssql

1. Go to this page and download the library: Download jkey/monolog-mssql 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/ */

    

jkey / monolog-mssql example snippets



ort class
use Monolog\Logger;
use Jkey\Monolog\Handler\MSSQLHandler;

$pdo = new PDO('sqlsrv:Server=localhost;Database=log', 'myuser', 'mypass');

//Create logger
$log = new Logger('name');
$log->pushHandler(new MSSQLHandler($pdo, "log", array('username', 'userid'), \Monolog\Logger::DEBUG));

//Now you can use the logger, and further attach additional information
$log->addWarning("This is a great message, woohoo!", array('username'  => 'John Doe', 'userid'  => 245));