承接 supersixtwo/dblog 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

supersixtwo/dblog

最新稳定版本:v1.0.1

Composer 安装命令:

composer require supersixtwo/dblog

包简介

Lightweight Laravel package for writing custom logs and error messages to a database.

README 文档

README

Latest Version on Packagist Total Downloads Software License

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:

$ composer require supersixtwo/dblog

Then add the service provider in config/app.php:

Supersixtwo\Dblog\DBlogServiceProvider::class,

And the alias in config/app.php:

'DBlog'		=> Supersixtwo\Dblog\DBlogClass::class,

Re-run the autoload:

$ composer dump-autoload

Publish the migrations:

$ php artisan vendor:publish

Run the migrations to install the tables in the database:

$ php artisan migrate

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 DBlog;

Use one of the 8 helper methods in your logic:

DBlog::emergency($msg);
DBlog::alert($msg);
DBlog::critical($msg);
DBlog::error($msg);
DBlog::warning($msg);
DBlog::notice($msg);
DBlog::info($msg);
DBlog::debug($msg);

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::info('New User Creation', ['id' => 45, 'created_by' => 'jdoe']);

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:

use Supersixtwo\Dblog\DBlogModel;

Then via Query Builder:

$logs = DB::table('dblogs')->get();

or via Eloquent:

$logs = DBlogModel::all();

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 appsupport@supersixtwo.com 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.

统计信息

  • 总下载量: 44
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-09-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固