2017 © Pedro Peláez
 

library phplogger

Free PHP logger for neat and powerful projects!

image

miladrahimi/phplogger

Free PHP logger for neat and powerful projects!

  • Thursday, March 15, 2018
  • by miladrahimi
  • Repository
  • 3 Watchers
  • 2 Stars
  • 29 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

PHPLogger

A simple logger for php projects, (*1)

Overview

PHP Logger is a simple package for PHP developers to log. It is implemented based on PSR-3 Standard., (*2)

Installation

Read How to use composer in php projects article if you are not familiar with Composer., (*3)

Run following command in your project root directory:, (*4)

composer require miladrahimi/phplogger

Manually

You may use your own autoloader as long as it follows PSR-0 or PSR-4 standards. Just put src directory contents in your vendor directory., (*5)

Getting Started

PHPLogger has potential to store logs into different kinds of storage, but for now you can only use directory (filesystem) to store them. Following codes illustrate how to define a directory storage and inject it to Logger class:, (*6)

use MiladRahimi\PHPLogger\Logger;
use MiladRahimi\PHPLogger\Directory;

$dir = new Directory("./logs/");
$logger = new Logger($dir);

As you see in the code snippet above, you can inject storage via Logger constructor, but if you want to use more storage, you may add them via following method:, (*7)

$logger->addStorage($my_storage);

Now you may store your first log:, (*8)

$logger->alert("This is an alert!");

Alert is not only supported log level out of the box, you may see all supported log level out there in PSR-3 page., (*9)

Log method

The broader method for logging is Logger::log() method which catches log level as its first parameter. Following example show how to use this method:, (*10)

use MiladRahimi\PHPLogger\Logger;
use MiladRahimi\PHPLogger\Directory;

$directory = new Directory(__DIR__);
$logger = new Logger($directory);
$logger->log("alert", "This is an alert message!");

To follow standards you may use LogLevel constants which are provided by PSR-3 standard., (*11)

use MiladRahimi\PHPLogger\Logger;
use MiladRahimi\PHPLogger\Directory;
use Psr\Log\LogLevel;

$logger = new Logger(new Directory(__DIR__));
$logger->log(LogLevel::ALERT, "This is an error message!");

Context

Context is the third parameter in Logger::log() method and second one for direct level log methods like Log::alert(). This parameter can be an array or an object which you may use to store more details alongside your log message., (*12)

License

PHPLogger is created by Milad Rahimi and released under the MIT License., (*13)

The Versions

15/03 2018

dev-master

9999999-dev http://miladrahimi.github.io/phplogger

Free PHP logger for neat and powerful projects!

  Sources   Download

MIT

The Requires

 

logger psr-3 php library free powerful neat

21/08 2015

1.6

1.6.0.0 http://miladrahimi.github.io/phplogger

Free PHP logger for neat and powerful projects!

  Sources   Download

MIT

The Requires

 

logger psr-3 php library free powerful neat

26/07 2015

1.5

1.5.0.0 http://miladrahimi.github.io/phplogger

Free PHP logger for neat and powerful projects!

  Sources   Download

MIT

The Requires

 

logger psr-3 php library free powerful neat

26/07 2015

1.4

1.4.0.0 http://miladrahimi.github.io/phplogger

Free PHP logger for neat and powerful projects!

  Sources   Download

MIT

The Requires

 

logger psr-3 php library free powerful neat

15/07 2015

1.3

1.3.0.0 http://miladrahimi.github.io/phplogger

Free PHP logger for neat and powerful projects!

  Sources   Download

MIT

The Requires

 

logger psr-3 php library free powerful neat

13/07 2015

dev-pr/1

dev-pr/1 http://miladrahimi.github.io/phplogger

Free PHP logger for neat and powerful projects!

  Sources   Download

MIT

The Requires

 

logger psr-3 php library free powerful neat

10/07 2015

v1.2

1.2.0.0 http://miladrahimi.github.io/phplogger

Free PHP logger for neat and powerful projects!

  Sources   Download

MIT

The Requires

 

logger psr-3 php library free powerful neat

10/07 2015

v1.1

1.1.0.0 http://miladrahimi.github.io/phplogger

Free PHP logger for neat and powerful projects!

  Sources   Download

MIT

The Requires

 

logger psr-3 php library free powerful neat

20/05 2015

v1.0.1

1.0.1.0 http://neatplex.com/project/phplogger

Free PHP logger for neat and powerful projects!

  Sources   Download

MIT

The Requires

 

logger psr-3 php library free powerful neat

19/05 2015

v1.0

1.0.0.0 http://neatplex.com/project/phplogger

Free PHP logger for neat and powerful projects!

  Sources   Download

MIT

The Requires

 

logger psr-3 php library free powerful neat