Download the PHP package jkey/monolog-mssql without Composer
On this page you can find all versions of the php package jkey/monolog-mssql. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package monolog-mssql
monolog-mssql
Microsoft SQL Server Handler for Monolog, which allows to store log messages in a MSSQL Table. It can log text messages to a specific table. The class further allows to use extra attributes as database field, which are can be used for later analyzing and sorting.
This is a fork from waza-ari/monolog-mysql, with some changes. The table and columns are not created or removed automatically.
Installation
monolog-mssql is available via composer. Just add the following line to your required section in composer.json and
do a php composer.phar update
.
After that you have to create your database table. We need the following structure, which you are free to extend.
Usage
Just use it as any other Monolog Handler, push it to the stack of your Monolog Logger instance. The Handler however needs some parameters:
- $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
- $additionalFields simple array of additional database fields, which should be stored in the database. The fields can later be used in the extra context section of a record. See examples below. _Defaults to an empty array()
- $level can be any of the standard Monolog logging levels. Use Monologs statically defined contexts. Defaults to Logger::DEBUG
- $bubble _Defaults to true
Examples
Given that $pdo is your database instance, you could use the class as follows:
License
This tool is free software and is distributed under the MIT license. Please have a look at the LICENSE file for further information.