piotrpress/logger 问题修复 & 功能扩展

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

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

piotrpress/logger

Composer 安装命令:

composer require piotrpress/logger

包简介

This library is compatible with PSR-3 file logger implementation.

README 文档

README

This library is compatible with PSR-3 file logger implementation.

Installation

composer require piotrpress/logger

Example

require __DIR__ . '/vendor/autoload.php';

use PiotrPress\Logger;
use PiotrPress\Logger\FileHandler;
use PiotrPress\Logger\ErrorLogHandler;

$logger = new Logger(
    new FileHandler( __DIR__ . '/' . date( 'Y-m-d' ) . '.log' ),
    new ErrorLogHandler() 
);
    
$logger->error( '[{module}] Example error', [ 'module' => 'Core' ] );

Saves: [error] [Core] Example error to file: {Y-m-d}.log and sends to PHP error log.

Logger

Logger take any number of handlers implementing HandlerInterface as constructor arguments.

Handlers

NOTE: Both handlers support optional FormatterInterface parameter.

Formatters

NOTE: Both formatters support optional path to template parameter.

Levels

Logger supports eight log methods to write logs to the eight RFC 5424 levels (debug, info, notice, warning, error, critical, alert, emergency) and a ninth method log, which accepts a log level as the first argument.

Context

All Logger log methods supports optional context array parameter.

All additional context array values, evaluated to string, can be used in message via corresponding keys put between a single opening brace { and a single closing brace } according to PSR-3 guidelines.

Context values can be also used in templates files as regular PHP variables.

Requirements

Supports PHP >= 7.4 version.

License

GPL3.0

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2021-03-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固