承接 adityadarma/laravel-database-logging 相关项目开发

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

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

adityadarma/laravel-database-logging

最新稳定版本:2.6.0

Composer 安装命令:

composer require adityadarma/laravel-database-logging

包简介

Logging activities database for laravel

README 文档

README

Laravel Database Logging is a feature that allows developers to store application logs in a database, rather than the default file-based storage. This feature provides a structured and organized approach to managing application logs, making it easier to query and analyze them.

Laravel Installation Instructions

  1. From your projects root folder in terminal run:

    composer require adityadarma/laravel-database-logging
  2. Install config and asset to record the activities to:

    php artisan database-logging:install
  3. Run the migration to add the table to record, before running please check morph key type on config to set type column:

    *Note: Before migrate, please check config /config/database-logging.php type data on morp relation

    php artisan migrate

Configuration

Laravel Database Logging can be configured in directly in /config/database-logging.php if you published the assets. Or you can variables to your .env file.

Environment File

Here are the .env file variables available:

ENABLE_LOGGING=true
QUERY_LOGGING=false
DURATION_LOGGING=30

Usage

Middleware Usage

Events for laravel authentication scaffolding are listened for as providers and are enabled via middleware. You can add events to your routes and controllers via the middleware:

capture-logging

Example to start recording page views using middleware in web.php:

Route::group(['middleware' => ['web', 'capture-logging']], function () {
    Route::get('/', 'WelcomeController@welcome')->name('welcome');
});

This middleware can be enabled/disabled in the configuration settings.

Trait Usage

Events can be recorded directly by using the trait. When using the trait you can customize the event description.

To use the trait:

  1. Include the call in the head of your class file:

    use \AdityaDarma\LaravelDatabaseLogging\Traits\DatabaseLoggable;
  2. Include the trait call in the opening of your class:

    use DatabaseLoggable;

Routes

Laravel Activity Dashboard Routes

Set route access from file config database-logging.php

  • /database-logging

Purge

Remove data logger

Set limit days data log from file config database-logging.php then run the command

  • database-logging:purge

License

This Package is licensed under the MIT license. Enjoy!

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-11