evolutionphp/error-handler 问题修复 & 功能扩展

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

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

evolutionphp/error-handler

最新稳定版本:v1.0

Composer 安装命令:

composer require evolutionphp/error-handler

包简介

Error Handler

README 文档

README

Error handler and save logs in files.

Installation

Use Composer to install Logger into your project:

composer require evolutionphp/error-handler

Configuration

Setup the logger

$config = [
	'path' => __DIR__.'/logs/',
	'ext' => 'php',
	'file_permissions' => 0644,
	'level' => 4,
	'date_format' => 'Y-m-d H:i:s'
];
$errorHandler = new \EvolutionPHP\ErrorHandler\ErrorHandler($config);
  • path: Directory where log files will be saved.
  • ext: set the extension of your log files. Leaving it blank will default to 'php'.
  • file_permissions: The file system permissions to be applied on newly created log files.
    This MUST be an integer (no quotes) and you MUST use octal integer notation (i.e. 0700, 0644, etc.)
  • level: You can enable error logging by setting a level over zero. The level determines what gets logged. Threshold options are:
    0 = Disables logging, Error logging TURNED OFF
    1 = Error Messages (including PHP errors)
    2 = Debug Messages
    3 = Informational Messages
    4 = All Messages
  • date_format: Each item that is logged has an associated date. You can use PHP date codes to set your own date formatting

Debug mode

$errorHandler = new \EvolutionPHP\ErrorHandler\ErrorHandler($config);
$errorHandler->debug();

Production mode

$errorHandler = new \EvolutionPHP\ErrorHandler\ErrorHandler($config);
$errorHandler->register();

Write a log

$errorHandler = new \EvolutionPHP\ErrorHandler\ErrorHandler($config);
$errorHandler->write_log('error','This is an error log.')

Throw an error

$errorHandler = new \EvolutionPHP\ErrorHandler\ErrorHandler($config);
$errorHandler->alertError('This is an exception.');

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-11