定制 crxgames/monolog-pomm 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

crxgames/monolog-pomm

Composer 安装命令:

composer require crxgames/monolog-pomm

包简介

A handler for Monolog that sends messages to Postgres via a POMM connection

README 文档

README

PostgreSQL Handler for Monolog utilizing the POMM library (http://www.pomm-project.org/), which allows to store log messages in a Postgres Table. It can log text messages to a specific table, and creates the table automatically if it does not exist.

Based on https://github.com/wiosna-dev/monolog-pg

Installation

monolog-pomm is available via composer. Just add the following line to your required section in composer.json and do a php composer.phar update.

"crxgames/monolog-pomm": ">1.0.0"

Usage

Just use it as any other Monolog Handler, push it to the stack of your Monolog Logger instance. The Handler however needs some parameters:

  • $pomm POMM Session instance of your database. Pass along the POMM instantiation of your database connection with your database selected.
  • $table The table name where the logs should be stored
  • $level can be any of the standard Monolog logging levels. Use Monologs statically defined contexts. Defaults to Logger::DEBUG
  • $bubble Defaults to true

Examples

Given that $pomm is your database session instance, you could use the class as follows:

//Import class
use PommPGHandler\PommPGHandler;

//Create MysqlHandler
$pommHandler = new PommPGHandler($pomm, "log");

//Create logger
$logger = new \Monolog\Logger($context);
$logger->pushHandler($mySQLHandler);

//Now you can use the logger, and further attach additional information
$logger->addWarning("This is a great message, woohoo!", array('username'  => 'John Doe', 'userid'  => 245));

License

This tool is free software and is distributed under the MIT license. Please have a look at the LICENSE file for further information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-05-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固