ascriver/debugview 问题修复 & 功能扩展

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

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

ascriver/debugview

最新稳定版本:v1.0.0

Composer 安装命令:

composer require ascriver/debugview

包简介

A custom Monolog handler for Windows DebugView.

README 文档

README

DebugView is a custom Monolog handler that sends log messages to the Windows DebugView utility using the OutputDebugStringA function from the Windows API.

Features

  • Integrates with Monolog for logging.
  • Sends log messages directly to DebugView for real-time debugging on Windows systems.
  • Lightweight and easy to use.

Installation

To install the package, use Composer:

composer require ascriver/debugview

Usage

Here is an example of how to use the DebugViewHandler in your project:

use Monolog\Logger;
use Ascriver\DebugViewHandler;

// Create a logger instance
$logger = new Logger('debug');

// Add the DebugViewHandler
$logger->pushHandler(new DebugViewHandler());

// Log a message
$logger->debug('This is a debug message');

Requirements

  • PHP 8.1 or higher
  • Windows operating system (required for OutputDebugStringA)
  • FFI must be enabled in your PHP configuration (php.ini):

⚠️ If FFI is disabled or restricted (e.g., in some shared hosting environments), this handler will not function correctly.

Development

Running Tests

This project uses PHPUnit for testing. To run the tests, first install the dependencies:

composer install

Then, run the tests:

vendor/bin/phpunit

Project Structure

  • src/: Contains the main source code, including the DebugViewHandler class.
  • tests/: Contains unit tests for the project.
  • composer.json: Defines the project dependencies and autoloading configuration.

Testing Notes

The DebugViewHandlerTest includes a test for the write method, which uses PHP's FFI to mock the OutputDebugStringA function. Reflection is used to inject the mock into the handler.

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix.
  3. Write tests for your changes.
  4. Submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-08