samuelirwin/logger 问题修复 & 功能扩展

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

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

samuelirwin/logger

Composer 安装命令:

composer require samuelirwin/logger

包简介

This is a wrapper package to create standard logging information for better debugging

README 文档

README

Latest Version on Packagist Total Downloads GitHub Actions

Installation

You can install the package via composer:

composer require samuelirwin/logger

Usage

Parameters Type Description
$class object Required
$method string Required
$logType string Required
$summary string Required
$details array Optional
Logger::record(object $class, string $method, string $logType, string $summary, array $details = [])

Example

You can use $this in a class to get the class object

class Foo {
    public function bar()
    {
        Logger::record(
            $this, // class object
            'bar', // name of the method
            'error', // log types; $allowedLogTypes = ['emergency', 'alert', 'critical', 'error', 'warning', 'notice', 'info', 'debug'];
            'Summary of error message', 
            [
                // inside here can be anything you want to log
                'detail-1' => 1,
                'detail-2' => 'new details',
                'details-3' => 'more details'
            ]);
    }
}

Result Output

{
    "context": "ClassName::methodName",
    "location": "/path/to/file",
    "details": {
        "id": 1,
        "code": 444,
        "message": "exception message"
    }
}
Allowed Log Types
emergency
alert
error
warning
notice
info
debug

Testing

composer test

Changelog

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 samuelirwin1992@gmail.com instead of using the issue tracker.

Credits

License

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

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-12-09