Download the PHP package supersixtwo/dblog without Composer
On this page you can find all versions of the php package supersixtwo/dblog. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download supersixtwo/dblog
More information about supersixtwo/dblog
Files in supersixtwo/dblog
Package dblog
Short Description Lightweight Laravel package for writing custom logs and error messages to a database.
License MIT
Homepage https://github.com/supersixtwo/dblog
Informations about the package dblog
DBlog - Custom Laravel Logs Writer
DBlog is a lightweight and simple Laravel Package that allows you write custom logs and error messages to a database table.
Written to mirror the Laravel Logging conventions, DBlog
provides 8 logging levels defined in RFC 5424 and the ability to add an optional context array to each log.
NOTE: This package DOES NOT integrate with the Laravel / Monolog logging system and does not capture system level events. It's purpose is to be used to capture your own custom log needs.
Installation
Via Composer:
Then add the service provider in config/app.php
:
And the alias in config/app.php
:
Re-run the autoload:
Publish the migrations:
Run the migrations to install the tables in the database:
Usage
Logging Messages
We've provided DBlog
with a familiar interface, mirroring Laravel's own built-in logging methods. These follow the same RFC 5424 defined logging levels including: emergency, alert, critical, error, warning, notice, info, and debug.
Include the DBlog
at the top of your class or model:
Use one of the 8 helper methods in your logic:
Contextual Information
In addition to logging text based messages, you can also an array of contextual information to the logging methods. This contextual data will converted to a json
array and stored in separate column.
DBlog Model and Table
Model and Table Names
To avoid collisions and naming conflicts with the DBlog Facade or other tables, the database table can be accessed using the following:
- Model Name:
DBlogModel
- Table Name:
dblogs
dblogs
Table Columns
Column | Type | Default Value | Nullable | Comments |
---|---|---|---|---|
id | int(10) unsigned | NO | ||
level_id | int(11) | NO | The RFC 5424 log level id | |
level_description | varchar(255) | NO | The RFC 5424 log level description | |
message | text | NO | ||
context | text | YES | ||
created_at | timestamp | CURRENT_TIMESTAMP | NO |
Querying the Model
First, include the DBlogModel
with the namespace:
Then via Query Builder:
or via Eloquent:
Change log
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Acknowledgements
This package is heavily inspired by the Monolog Logging Library.