承接 taeluf/error-handler 相关项目开发

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

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

taeluf/error-handler

Composer 安装命令:

composer require taeluf/error-handler

包简介

An error handler w/ simple configuration and high ease-of-use.

README 文档

README

PHP Error Handler

A PHP error handler w/ simple configuration and high ease-of-use.

UNDER DEVELOPMENT:

  • v1.0 may include breaking changes for the forseeable future.
  • not all documented features are currently implemented

Install

composer require taeluf/error-handler v1.0.x-dev   

or in your composer.json

{"require":{ "taeluf/error-handler": "v1.0.x-dev"}}  

Usage

First setup per instructions below.

<?php  
  
$args_to_log = ['exception'=> new \Exception("Error here!")];  
\Tlf\ErrorHandler::log("User Mesage only ...");  
// or include a separate debug message, custom log file name, and array of args to log  
\Tlf\ErrorHandler::log('User Message ...', 'Debug Message...', 'main.txt', $args_to_log);  

You may, in your project, create a no namespaced log() function that calls the error handler, just to save keystrokes.

You may use an instance of ErrorHandler (via constructor or init) instead, but its more cumbersome that way.

Setup

Run vendor/bin/tlferr init to create the config file for you & print a php setup script, for you to copy+paste.

config/tlferr.json:

{  
    "log_dir": "logs",  
    "print_mode": "print_all",  
    "handle_exceptions": true,  
    "handle_php_error_log": true,  
    "max_log_msg_chars": 100  
}  

PHP Initialization:

<?php  
  
$project_root_dir = __DIR__;  
$error_handler = \Tlf\ErrorHandler::init($project_root_dir, 'config/tlferr.json');  
$error_handler->print_mode = \Tlf\ErrorHandler::determine_print_mode(); # PRINT_DEBUG unless running in a non-localhost http environment  
// Or use enum \Tlf\ErrorHandler\Mode:  
# \Tlf\ErrorHandler\Mode::PRINT_ALL  
# \Tlf\ErrorHandler\Mode::PRINT_DEBUG  
# \Tlf\ErrorHandler\Mode::PRINT_USER_FRIENDLY  
# \Tlf\ErrorHandler\Mode::PRINT_NONE  

print_mode can be set in config with lower-case version of the enums above, like "print_all" or "print_none"

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固