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: 2022-04-25 03:10:28 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;
}