struktal/struktal-logger 问题修复 & 功能扩展

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

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

struktal/struktal-logger

最新稳定版本:1.0.2

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.

统计信息

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

GitHub 信息

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

其他信息

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