struktal/struktal-logger
Composer 安装命令:
composer require struktal/struktal-logger
包简介
PHP library to write log messages to a file
关键字:
README 文档
README
This is a PHP library to write log messages to a file
Installation
To install this library, include it in your project using Composer:
composer require struktal/struktal-logger
Usage
Before you can use this library, you need to customize a few parameters. You can do this in the startup of your application:
\struktal\Logger\Logger::setLogDirectory("/path/to/logs/"); \struktal\Logger\Logger::setMinLogLevel(\struktal\Logger\LogLevel::TRACE);
You can also set custom, additional log handlers if you want to log to a database or send error logs via email:
\struktal\Logger\Logger::addCustomLogHandler( \struktal\Logger\LogLevel::ERROR, function(string $formattedMessage, string $serializedMessage, mixed $originalMessage) { // Custom log handler logic here } );
Then, in your code, you can instantiate the logger by using
$logger = new \struktal\Logger\Logger("custom-tag");
and use it to log messages with different log levels:
$logger->trace("This is a trace message"); $logger->debug("This is a debug message"); $logger->info("This is an info message"); $logger->warn("This is a warning message"); $logger->error("This is an error message"); $logger->fatal("This is a fatal message");
License
This software is licensed under the MIT license. See the LICENSE file for more information.
struktal/struktal-logger 适用场景与选型建议
struktal/struktal-logger 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.44k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 08 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「logging」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 struktal/struktal-logger 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 struktal/struktal-logger 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 struktal/struktal-logger 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Zend Framework module that sets up Monolog for logging in applications.
Asynchronous Sentry for Symfony - Fire and forget
Stackdriver handler for Monolog (codeinternetapplications/monolog-stackdriver Fork).
High-performance, zero-dependency PSR-3 logger for MonkeysLegion with structured logging, handlers, processors, and PHP 8.4 features.
Audit changes of your Eloquent models in Laravel/Lumen
Ship logs and exceptions from a Laravel app to a Log Central server.
统计信息
- 总下载量: 1.44k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-20