sinevia/php-library-sqldb-monolog

PHP Library Monolog Handler for SqlDb

v1.2.0 2019-06-24 20:06 UTC

This package is auto-updated.

Last update: 2024-12-25 09:25:42 UTC


README

/**
 * Logger function
 * @return \Monolog\Logger
 */
function logger($channel="default")
{
    static $logger = null;

    if (is_null($logger)) {
        //Create MysqlHandler
        $mySQLHandler = new \Sinevia\SqlDbMonologHandler($YOURPDO, $YOOURLOGTABLENAME, \Monolog\Logger::DEBUG);

        //Create logger
        $logger = new \Monolog\Logger($channel);
        $logger->pushHandler($mySQLHandler);
    }

    return $logger;
}