fabcam/console-logger 问题修复 & 功能扩展

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

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

fabcam/console-logger

Composer 安装命令:

composer require fabcam/console-logger

包简介

Console Logger plugin for CakePHP

README 文档

README

#Console Logger plugin for CakePHP

Logs whatever you want to console.

Usage:

Import Logger

use ConsoleLogger\Log\Logger;

And then:

Logger::log('message', 'info');

log function can receive as a message an array, object or string. Second parameter is level, used mostly for styling.

There are some pre defined levels:

$output->styles('annoy', ['text' => 'yellow', 'blink' => true]);
$output->styles('http_response', ['text' => 'yellow']);
$output->styles('http_request', ['text' => 'cyan']);

And some defined in Cake's class ConsoleOutput:

protected static $_styles = [
    'emergency' => ['text' => 'red'],
    'alert' => ['text' => 'red'],
    'critical' => ['text' => 'red'],
    'error' => ['text' => 'red'],
    'warning' => ['text' => 'yellow'],
    'info' => ['text' => 'cyan'],
    'debug' => ['text' => 'yellow'],
    'success' => ['text' => 'green'],
    'comment' => ['text' => 'blue'],
    'question' => ['text' => 'magenta'],
    'notice' => ['text' => 'cyan']
];

There is one base controller that could be used to log every action. In your AppController:

...

use ConsoleLogger\Controller\BaseController;

class AppController extends BaseController
{
  ...

There is also a wrapper for Http Client class that logs every http method requests and responses Instead of using Cake's Http Client do:

use ConsoleLogger\Http\Client;

A behavior is also included in oder to log every query that is executed in the BeforeFind callback. In order to use it just add the following line to the desired Table:

$this->addBehavior('ConsoleLogger.Log')

Installation

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer require fabcam/console-logger

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-04-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固