承接 irap/exception-logger 相关项目开发

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

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

irap/exception-logger

最新稳定版本:1.2.0

Composer 安装命令:

composer require irap/exception-logger

包简介

Package for capturing and logging uncaught exceptions.

README 文档

README

A package to capture uncaught exceptions and log them using the provided logger. All you have to do is create the object like so:

new \iRAP\ExceptionLogger\ExceptionLogger(
    $logger, // objec tof LoggerInterface
    "My Service", 
    $nextExcptionHandler=function(Throwable $e) { /*  do nothing */ }
);

This will result in any uncaught exceptions being logged. The object works by setting the exception handler so it won't have any effect if you call set_exception_handler after having created the object.

If you want to run your own exception handler, you can just have it be called by the callback as shown below:

/* @var $logger LoggerInterface */
$nextExcptionHandler = function(Throwable $e) { 
    // my custom uncaught exception handling goes here.
};

new \iRAP\ExceptionLogger\ExceptionLogger(
    $logger,
    "My Service", 
    nextExcptionHandler
);

If you don't have a custom exception handler, I would recommend restoring PHP's default exception handling by doing the following:

$next = function(Throwable $e) { 
    restore_exception_handler();
    throw $e; //This triggers the previous exception handler
};

new \iRAP\ExceptionLogger\ExceptionLogger(
    $logger,
    "My Service", 
    $next
);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-08-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固