kynetcode/wpzylos-logger
Composer 安装命令:
composer require kynetcode/wpzylos-logger
包简介
PSR-3 compliant logging for WPZylos framework
README 文档
README
PSR-3 compliant logging for WPZylos framework.
📖 Full Documentation | 🐛 Report Issues
✨ Features
- PSR-3 Compliant — Standard
LoggerInterfaceimplementation - 8 Log Levels — Emergency through Debug
- Context Interpolation —
{placeholder}token support - Exception Stack Traces — Auto-appended via
exceptioncontext key - Daily Log Files — Automatic daily file rotation
- Minimum Level Filter — Only log above a threshold
- Log Cleanup —
cleanOldLogs()deletes old files - ServiceProvider — Container-ready with PSR-3 binding
📋 Requirements
| Requirement | Version |
|---|---|
| PHP | ^8.0 |
| WordPress | 6.0+ |
🚀 Installation
composer require KYNetCode/wpzylos-logger
📖 Quick Start
1. Register ServiceProvider
$app->register(new \WPZylos\Framework\Logger\LoggerServiceProvider());
2. Use via Container
use Psr\Log\LoggerInterface; $logger = $app->make(LoggerInterface::class); // or: $app->make('log'); // or: $app->make('logger'); $logger->info('User {name} logged in', ['name' => 'John']); $logger->error('Payment failed', ['order_id' => 456]);
3. Direct Instantiation
use WPZylos\Framework\Logger\Logger; $logger = new Logger($context, null, 'warning'); $logger->warning('Low disk space');
🏗️ Core Features
Log Levels
$logger->emergency('System is unusable'); $logger->alert('Action must be taken immediately'); $logger->critical('Critical conditions'); $logger->error('Error conditions'); $logger->warning('Warning conditions'); $logger->notice('Normal but significant condition'); $logger->info('Informational messages'); $logger->debug('Debug-level messages');
Context Data
$logger->info('Order placed', [ 'order_id' => $order->id, 'user_id' => $user->id, 'total' => $order->total, ]);
Log Files
// Logs written to: wp-content/uploads/{slug}/logs/2025-01-15.log $logger->info('Application started'); // Clean old logs (30 days default) $deleted = $logger->cleanOldLogs(30);
📦 Related Packages
| Package | Description |
|---|---|
| wpzylos-core | Application foundation |
| wpzylos-scaffold | Plugin template |
📖 Documentation
For comprehensive documentation, tutorials, and API reference, visit wpzylos.com.
☕ Support the Project
📄 License
MIT License. See LICENSE for details.
🤝 Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Made with ❤️ by KYNetCode
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2026-06-16