2017 © Pedro Peláez
 

library a-logger

A Simple Logging Class For PHP

image

kozintsev/a-logger

A Simple Logging Class For PHP

  • Sunday, November 12, 2017
  • by kozintev
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 1 Versions
  • 25 % Grown

The README.md

ALogger is fork KLogger and simple logging for PHP

A project forked and refactored Oleg Kozinsev., (*1)

About

All that relates to Klogger is also relevant for ALogger. But Alogger creates an instance of the object for saving every time it is saved, which allows you to delete the log file while you work. Also removed all options and added the ability to split the file into parts., (*2)

Composer

From the Command Line:, (*3)

composer require kozintsev/a-logger:dev-master

In your composer.json:, (*4)

``` json { "require": { "kozintsev/a-logger": "dev-master" } }, (*5)


## Basic Usage ``` php <?php require_once ("vendor/autoload.php"); use kozintsev\ALogger\Logger; $logger = new Logger(__DIR__ . '/tests/logs/test.log', \Psr\Log\LogLevel::DEBUG); $logger->info('Returned a million search results'); $logger->error('Oh dear.'); $logger->debug('Got these users from the Database.', $users);

Output

[2014-03-20 3:35:43.762437] [INFO] Returned a million search results
[2014-03-20 3:35:43.762578] [ERROR] Oh dear.
[2014-03-20 3:35:43.762795] [DEBUG] Got these users from the Database.
    0: array(
        'name' => 'Kenny Katzgrau',
        'username' => 'katzgrau',
    )
    1: array(
        'name' => 'Dan Horrigan',
        'username' => 'dhrrgn',
    )

Additional Options

ALogger supports additional options via third parameter in the constructor:, (*6)

php <?php // Example $logger = new kozintsev\ALogger\Logger(__DIR__ . '/tests/logs/test.log', Psr\Log\LogLevel::WARNING, [ 'max_file_size' => 0, // max file size, if set to 0, the size is not checked ]);, (*7)

Here's the full list:, (*8)

Option Default Description
max_file_size 5120000 the maximum size of the log file, if set to 0, the size is not checked

The Versions

12/11 2017

dev-master

9999999-dev

A Simple Logging Class For PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Oleg Kozintsev

logging