exbico/monolog-db-handler 问题修复 & 功能扩展

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

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

exbico/monolog-db-handler

最新稳定版本:2.1.0

Composer 安装命令:

composer require exbico/monolog-db-handler

包简介

DB handler for monolog

README 文档

README

ci Latest Stable Version Total Downloads License

INSTALLATION

The preferred way to install this extension is through composer:

composer require exbico/monolog-db-handler

Basic Usage

<?php

use Monolog\Level;
use Monolog\Logger;
use Exbico\Handler\DbHandler;
use Exbico\Handler\DbHandlerConfig;
use Exbico\Handler\Connection\PdoAdapter;

$connection = new PdoAdapter(new PDO(dsn: 'pgsql:dbname=foo;host=127.0.0.1', username: 'root', password: null));

$logger = new Logger('example',[new DbHandler(connection: $connection)]);

// You can also specify which level of messages should be logged and the table name for each level

$config = new DbHandlerConfig(
    emergency: 'log_emergency',
    alert:     'log_alert',
    critical:  'log_critical',
    error:     'log_error',
    warning:   'log_warning',
    notice:    'log_notice',
    info:      'log_info',
    debug:     null, // debug level will not be logged
);

$logger->pushHandler(new DbHandler(connection: $connection, config: $config));

You need to create set of required tables with the following fields:

  • level - varchar
  • message - varchar|text
  • datetime - datetime
  • context - text|json|jsonb
  • extra - text|json|jsonb

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-09