承接 joefallon/phplog 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

joefallon/phplog

Composer 安装命令:

composer require joefallon/phplog

包简介

This package contains simple PSR logger that minimizes line length.

关键字:

README 文档

README

By Joe Fallon

A simple logging library. It has the following features:

  • Full suite of unit tests.
  • It can be integrated into any existing project.
  • Can be fully understood in just a few moments.
  • Each line of log text contains minimal prefix cruft.
  • Fully psr/log compliant.

Installation

The easiest way to install PhpDatabase is with Composer. Create the following composer.json file and run the php composer.phar install command to install it.

{
    "require": {
        "joefallon/phplog": "*"
    }
}

Usage

There is one class contained in this library called Log. It contains the following methods:

__construct($filePath, $level)
emergency($message, array $context = array())
alert($message, array $context = array())
critical($message, array $context = array())
error($message, array $context = array())
warning($message, array $context = array())
notice($message, array $context = array())
info($message, array $context = array())
debug($message, array $context = array())
log($level, $message, array $context = array())

Example log entrys with contexts looks like this:

2015-02-05 10:35:20 [DEBUG] Test debug. {"contextKey":"contextVal"}
2015-02-05 10:35:20 [INFO] Test info. {"contextKey":"contextVal"}
2015-02-05 10:35:20 [LOG] Test notice. {"contextKey":"contextVal"}
2015-02-05 10:35:20 [WARN] Test warning. {"contextKey":"contextVal"}
2015-02-05 10:35:20 [ERROR] Test error. {"contextKey":"contextVal"}
2015-02-05 10:35:20 [CRITICAL] Test critical. {"contextKey":"contextVal"}
2015-02-05 10:35:20 [ALERT] Test alert. {"contextKey":"contextVal"}
2015-02-05 10:35:20 [EMERGENCY] Test emergency. {"contextKey":"contextVal"}
2015-02-05 10:35:20 [ALERT] Test off message. {"contextKey":"contextVal"}

Example log entrys without contexts looks like this:

2015-02-05 10:35:20 [DEBUG] Test debug.
2015-02-05 10:35:20 [INFO] Test info.
2015-02-05 10:35:20 [LOG] Test notice.
2015-02-05 10:35:20 [WARN] Test warning.
2015-02-05 10:35:20 [ERROR] Test error.
2015-02-05 10:35:20 [CRITICAL] Test critical.
2015-02-05 10:35:20 [ALERT] Test alert.
2015-02-05 10:35:20 [EMERGENCY] Test emergency.
2015-02-05 10:35:20 [ALERT] Test off message.

Open Log and Write a Debug Message

$logger = new Log('/tests/logs/' . date('Y-m-d') . '.log', Log::DEBUG);
$logger->debug('Test debug.', array('contextKey' => 'contextVal'));

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-07-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固