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

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

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

phputil/logger

Composer 安装命令:

composer require phputil/logger

包简介

A very simple logger

README 文档

README

A very simple logger for PHP. No magic configuration required. Just the basic features you need most.

Provided interfaces and classes:

Available log methods:

  • bool debug( string $message, Exception $e = null, array $context = array() );
  • bool info( string $message, Exception $e = null, array $context = array() );
  • bool warn( string $message, Exception $e = null, array $context = array() );
  • bool error( string $message, Exception $e = null, array $context = array() );
  • bool log( string $logType, string $message, Exception $e = null, array $context = array() );

Installation

composer require phputil/logger

Example 1

<?php
require_once 'vendor/autoload.php'; // composer

use phputil\TextFileLogger;

// It is recommended to set the DateTimeZone when using TextFileLogger.
$logger = new TextFileLogger( 'log.txt', false, new \DateTimeZone( 'America/Sao_Paulo' ) );

$logger->info( 'Something will happen' );
$logger->debug( 'Something happened.' );
$logger->warn( 'Wait!' );
$logger->error( 'Ouch.' );

$logger->log( Logger::DEBUG, "That's awesome!" );
?>

Example 2

<?php
require_once 'vendor/autoload.php'; // composer

use phputil\Logger;
use phputil\TextFileLogger;
use phputil\FakeLogger;

$inDebugMode = true;

$logger = $inDebugMode
	? new TextFileLogger( 'log.txt', false, new \DateTimeZone( 'America/Sao_Paulo' ) )
	: new FakeLogger();

$logger->info( 'Something will happen' );
try {
	throw new \Exception( 'Hummm... something bad happened.' );
} catch ( \Exception $e ) {
	// Logs message and trace
	$logger->error( 'Ouch, I did not expect that!', $e );
}

$logger->log( Logger::DEBUG, "That's awesome!" );
?>

Example 3

<?php
require_once 'vendor/autoload.php'; // composer

use phputil\EchoLogger;

$logger = new EchoLogger();
$logger->info( 'It can log to the console too!' );
?>

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: LGPL-3
  • 更新时间: 2016-07-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固