devraeph/laravel-alh 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

devraeph/laravel-alh

最新稳定版本:0.2.0

Composer 安装命令:

composer require devraeph/laravel-alh

包简介

Another Logging Helper for Laravel

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Another small and simple logging package. Mostly I created this for my self and wanted to simplify logging stuff for my ongoing projects.

If anyone can make use of this you're welcome to contribute or open an issue.

Installation

You can install the package via composer:

composer require devraeph/laravel-alh

You can install the package with:

php artisan alh:install

OR manually

You can publish and run the migrations with:

php artisan vendor:publish --tag="laravel-alh-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="laravel-alh-config"

This is the contents of the published config file:

return [
    'logging' => [
        'in_productions' => env("ALH_LOG_IN_PRODUCTION",false),
        "to_database" => env("ALH_TO_DB",false),
        "to_file" => env("ALH_TO_FILE",true),
        "file_driver" => env("ALH_FILE_DRIVER","local"),
        "file_path" => env("ALH_FILE_PATH","logs_alh"),
        "separate_by_type" => env("ALH_SEPARATE_BY_TYPE",false),
    ],
    'general' => [
        "clear_logs" => false,
        'retention' => env("ALH_LOG_RETENTION",7), //Keep Logs for 7 days by default
    ],

];

Optionally, you can publish the views using

php artisan vendor:publish --tag="laravel-alh-views"

Usage

  /*
   * Uses default mechanism
   * configured in config/alh.php
   * default only toFile and not in production
   */
   
   ALH::error("Error message",new Exception("ex"));
   ALH::warning("Warning message",new Exception("ex"));
   ALH::info("Info message");
   ALH::success("Success message");
   ALH::pending("Pending message");

   /*
   * Override config settings
   */

   /* Log Only to DB */
   ALH::toDB()->error("Error message",new Exception("ex"));
   /* Log only to File */
   ALH::toFile()->error("Error message",new Exception("ex"));
   /* Force Log both */
   ALH::toDB()->toFile()->error("Error message",new Exception("ex"));

   /*
   * Option to set Log issuer like User
   */
   ALH::setIssuer(User::first())->error("Error message",new Exception("ex"));

Access DB Logs

Dashboard at /alh-logs

The gate definition is similar to laravel/horizon.

You can change the defaults at app/Providers/ALHMainServiceProvider.php

protected function gate(): void
{
    Gate::define('viewALH', function (User $user) {
        return in_array($user->email, [
            //
        ]);
    });
}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固