comphp/logging
最新稳定版本:v0.1
Composer 安装命令:
composer require comphp/logging
包简介
A minimal, PSR-3 compliant logging library designed for flexibility and simplicity.
README 文档
README
A minimal, PSR-3 compliant logging library designed for flexibility and simplicity. It supports multiple log outputs, custom logger configurations, and log level filtering—keeping things as lean as your favorite retro toolkit.
Features
- PSR-3 Compliant: Implements the standard logging interface.
- Custom Logger Implementations: Includes examples like
BuiltinLoggerandNullLogger. - LogManager: Easily handle and dispatch log messages to one or more logger instances.
- Flexible Configuration: Configure logger behavior, including log level filtering and custom setups.
- Multiple Outputs: Log to multiple destinations without breaking standards.
Installation
Install via Composer:
composer require comphp/logging
Usage
Create and configure logger instances, then add them to the LogManager:
<?php require 'vendor/autoload.php'; use Neuron\Logging\LogManager; use Neuron\Logging\LogLevel; use Neuron\Logging\Loggers\FileLogger; // Initialize the log manager $logManager = new LogManager($container); $logManager->load(ThirdPartyFileLogger::class, [ 'filePath' => __DIR__ . '/logs/app.log', 'supported' => [LogLevel::INFO, LogLevel::WARNING, LogLevel::ERROR], ]) // Dispatch some log messages $logManager->info("Application started", ['user' => 'Alice']); $logManager->error("Unhandled exception", ['exception' => 'RuntimeException']);
Examples
Additional example scripts are provided in the examples/ directory, demonstrating how to use different logger implementations and configurations.
Changelog
See CHANGELOG.md for a record of changes.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details on how to help out.
Code of Conduct
This project is released under a Code of Conduct. Please review CODE_OF_CONDUCT.md for details.
License
This project is licensed under the MIT License. See the LICENSE file for more information.
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-15