2017 © Pedro Peláez
 

phile-plugin phile-logger

Adds logging support to Phile CMS

image

sturple/phile-logger

Adds logging support to Phile CMS

  • Monday, November 9, 2015
  • by sturple
  • Repository
  • 1 Watchers
  • 0 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Logger For Phile CMS

This is a simple plugin, which allows logging to be enabled during development and testing of other plugins., (*1)

This logger uses katzgrau/klogger for operations which has one dependent psr/log., (*2)

Installation

Composer

php composer.phar require sturple/phile-logger:dev-master

Download

* Install [Phile](https://github.com/PhileCMS/Phile)
* Clone this https://github.com/sturple/phileLogger repo into `plugins/sturple/phileLogger/`

Usage

setup config.php

``` php $config['plugins']['sturple\phileLogger'] =array('active' => false);, (*3)



### Example to be used in other plugins ``` php $relDir = 'lib/cache/logs'; $logLevel = '{debug|info|notice|warning|error|critical|alert|emergency}' $options = array('extension' => 'txt', 'dateFormat' => 'Y-m-d G:i:s.u', 'filename' => false, 'flushFrequency' => false, 'prefix' => 'log_', 'logFormat' => false, 'appendContext' => true); $logger = (new \Phile\Plugin\Sturple\PhileLogger\Plugin($relDir='lib/cache/logs', $logLevel='debug', $options=array()))->getLogger(); $logger->info('You can use functions debug, info, notice, warning, error, critical, alert.'); $logger->warning('You can add arrays',array('phile'=>'CMS'));

Options

Option Default Description
dateFormat 'Y-m-d G:i:s.u' The format of the date in the start of the log lone (php formatted)
extension 'txt' The log file extension
filename [prefix][date].[extension] Set the filename for the log file. This overrides the prefix and extention options.
flushFrequency false (disabled) How many lines to flush the output buffer after
prefix 'log_' The log file prefix
logFormat false Format of log entries
appendContext true When false, don't append context to log entries

Log Formatting

The logFormat option lets you define what each line should look like and can contain parameters representing the date, message, etc., (*4)

When a string is provided, it will be parsed for variables wrapped in braces ({ and }) and replace them with the appropriate value:, (*5)

Parameter Description
date Current date (uses dateFormat option)
level The PSR log level
level-padding The whitespace needed to make this log level line up visually with other log levels in the log file
priority Integer value for log level (see $logLevels)
message The message being logged
context JSON-encoded context

The Versions

09/11 2015

dev-master

9999999-dev http://github.com/sturple/phile-logger

Adds logging support to Phile CMS

  Sources   Download

MIT

The Requires

 

logger logging cms content phile