jeremycurny/monolog-mysqlhandler

This package is abandoned and no longer maintained. No replacement package was suggested.

A handler for Monolog that sends logs to MySQL

v0.0.3 2016-07-03 15:47 UTC

This package is auto-updated.

Last update: 2019-09-24 19:11:46 UTC


README

MySQL Handler for Monolog

Example

use Monolog\Handler\MysqlHandler;
use Monolog\Logger;

$logger = new Logger("myLogger");
$tableName = "logger";

$logger->pushHandler(new MysqlHandler($pdo, $tableName, Logger::DEBUG));

$logger->info("This is my first log !");

Create the table

CREATE TABLE `logger` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `message` varchar(255) NOT NULL,
  `context` text NOT NULL,
  `level` int(10) unsigned NOT NULL,
  `level_name` varchar(31) NOT NULL,
  `channel` varchar(255) NOT NULL,
  `datetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

License

This tool is free software and is distributed under the MIT license. Please have a look at the LICENSE file for further information.

Jeremy Curny