2017 © Pedro Peláez
 

cakephp-plugin console-logger

Console Logger plugin for CakePHP

image

fabcam/console-logger

Console Logger plugin for CakePHP

  • Wednesday, May 9, 2018
  • by fabcam
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 133 % Grown

The README.md

Console Logger plugin for CakePHP

Logs whatever you want to console., (*1)

Usage:, (*2)

Import Logger, (*3)

use ConsoleLogger\Log\Logger;

And then:, (*4)

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

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

There are some pre defined levels:, (*6)

$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:, (*7)

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:, (*8)

...

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:, (*9)

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:, (*10)

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

Installation

You can install this plugin into your CakePHP application using composer., (*11)

The recommended way to install composer packages is:, (*12)

composer require fabcam/console-logger

The Versions

09/05 2018

dev-master

9999999-dev

Console Logger plugin for CakePHP

  Sources   Download

MIT

The Requires

 

The Development Requires

09/05 2018

v1.1

1.1.0.0

Console Logger plugin for CakePHP

  Sources   Download

MIT

The Requires

 

The Development Requires

23/04 2018

1.0.0.x-dev

1.0.0.9999999-dev

Console Logger plugin for CakePHP

  Sources   Download

MIT

The Requires

 

The Development Requires

23/04 2018

v1.0

1.0.0.0

Console Logger plugin for CakePHP

  Sources   Download

MIT

The Requires

 

The Development Requires