2017 © Pedro Peláez
 

library monolog-mysql

A handler for Monolog that sends messages to MySQL

image

vsemayki/monolog-mysql

A handler for Monolog that sends messages to MySQL

  • Tuesday, January 31, 2017
  • by VseMayki
  • Repository
  • 2 Watchers
  • 2 Stars
  • 298 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 48 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

monolog-mysql

MySQL Handler for Monolog, which allows to store log messages in a MySQL table. It can log text messages to a monolog table. The class further is added extra attributes - channel, level, ip, created_at and user_agent, which are stored in a separate database fields, and can be used for later analyzing and sorting., (*1)

Installation

monolog-mysql is available via composer:, (*2)

composer require vsemayki/monolog-mysql:^2.0

Usage

First of all, import dump.sql., (*3)

Just use it as any other Monolog Handler, push it to the stack of your Monolog Logger instance. The Handler however needs some parameters:, (*4)

  • $pdo PDO Instance of your database. Pass along the PDO instantiation of your database connection with your database selected.
  • $table The table name where the logs should be stored
  • $level can be any of the standard Monolog logging levels. Use Monologs statically defined contexts. Defaults to Logger::INFO
  • $bubble Defaults to true

Examples

Given that $pdo is your database instance, you could use the class as follows:, (*5)

<?php
use MySQLHandler\MySQLHandler;

$mySQLHandler = new MySQLHandler($pdo, 'monolog', $level = \Monolog\Logger::INFO, $bubble = true);

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

// Now you can use the logger, and further attach additional information
// user_id is required!
$logger->addInfo('User has been created, woohoo!', ['action' => 'user/create', 'user_id' => 3562]);

License

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

The Versions

31/01 2017

dev-master

9999999-dev https://github.com/vsemayki/monolog-mysql

A handler for Monolog that sends messages to MySQL

  Sources   Download

MIT

The Requires

 

by Daniel Herrmann
by Oleg Shabashov

database log logging monolog mysql

31/01 2017

3.0.0

3.0.0.0 https://github.com/vsemayki/monolog-mysql

A handler for Monolog that sends messages to MySQL

  Sources   Download

MIT

The Requires

 

by Daniel Herrmann
by Oleg Shabashov

database log logging monolog mysql

27/01 2017

2.0.1

2.0.1.0 https://github.com/vsemayki/monolog-mysql

A handler for Monolog that sends messages to MySQL

  Sources   Download

MIT

The Requires

 

by Daniel Herrmann
by Oleg Shabashov

database log logging monolog mysql

27/01 2017

2.0.0

2.0.0.0 https://github.com/vsemayki/monolog-mysql

A handler for Monolog that sends messages to MySQL

  Sources   Download

MIT

The Requires

 

by Daniel Herrmann
by Oleg Shabashov

database log logging monolog mysql

13/07 2015

v1.0.3

1.0.3.0 https://github.com/waza-ari/monolog-mysql

A handler for Monolog that sends messages to MySQL

  Sources   Download

MIT

The Requires

 

by Daniel Herrmann

database log logging monolog mysql

16/02 2015

v1.0.2

1.0.2.0 https://github.com/waza-ari/monolog-mysql

A handler for Monolog that sends messages to MySQL

  Sources   Download

MIT

The Requires

 

by Daniel Herrmann

database log logging monolog mysql

25/11 2014

v1.0.1

1.0.1.0 https://github.com/waza-ari/monolog-mysql

A handler for Monolog that sends messages to MySQL

  Sources   Download

MIT

The Requires

 

by Daniel Herrmann

database log logging monolog mysql

13/09 2014

v1.0.0

1.0.0.0 https://github.com/waza-ari/monolog-mysql

A handler for Monolog that sends messages to MySQL

  Sources   Download

MIT

The Requires

 

by Daniel Herrmann

database log logging monolog mysql