定制 div-art/logger 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

div-art/logger

Composer 安装命令:

composer require div-art/logger

包简介

create log file

README 文档

README

Logger package for Laravel

Installation

To install, run the following in your project directory:

$ composer require div-art/logger

If you are using laravel version >= 5.5 you can skip this step:

In config/app.php add the following to the providers array:

\DivArt\Logger\LoggerServiceProvider::class,

Also in config/app.php, add the Facade class to the aliases array:

'Logger' => \DivArt\Logger\Facades\Logger::class,

Configuration

To publish Logger's configuration file, run the following vendor:publish command:

php artisan vendor:publish --provider="DivArt\Logger\LoggerServiceProvider"

It will create logger.php file in config/logger.php.

To manage directory for storing logs just change default value of 'path':

//the root is storage directory
'path' => 'your path',

By default logs lifetime is 7 days, to change it:

//if you set this to 0 - logs will not be deleted
'expire_days' => 7

Usage

** Do not forget to include the namespace for the controller class where you plan to use this library **

use DivArt\Logger\Facades\Logger;

But if you are using laravel >= 5.5 you can skip this.

Example:

Logger::save(array('name' => 'sani', 'year' => '30'));

Create logfile in default path 'storage/logger' whith name date.json

date.json:

{ 'name' => 'sani', 'year' => '30' }

Route:

//get all logs
Route::get('/div-art/logger/all/{date?}');

To manage all your logs go to this link example in browser http://your-app.xyz/div-art/logger/all

Methods:

Logger::save(data, 'mark');
Logger::info(data, 'mark');
Logger::danger(data, 'mark');
Logger::success(data, 'mark');

//data - data (string, number, boolean value, array, object), required parameter
//mark - string mark for filtering logs, optional parameter

Logger::request('key');
Logger::input('key');
Logger::json('key');
Logger::post('key');
Logger::get('key');
Logger::php('key');
Logger::server('key');
Logger::cookies('key');
Logger::headers('key');

//key - is an optional parameter that specifies a particular key from an array or object to be written

License

The MIT License (MIT). Please see License File for more information."# Logger" "# Logger"

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 4
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-01-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固