mikeevstropov/simple-logger
Simple way to create instance of Monolog\Logger, (*1)
Installation
Add dependency mikeevstropov/simple-logger, (*2)
$ composer require mikeevstropov/simple-logger
Usage
<?php
use Mikeevstropov\SimpleLogger\LoggerFactory;
$logger = LoggerFactory::create(
'path/to/file.log',
'DEBUG',
'log-name'
);
// add records to the log
$logger->warning('Warning message');
$logger->error('Error message');
// .. or other levels described by RFC 5424
LoggerFactory Interface
Log Levels
Monolog supports the logging levels described by RFC 5424., (*7)
-
DEBUG (100): Detailed debug information., (*8)
-
INFO (200): Interesting events. Examples: User logs in, SQL logs., (*9)
-
NOTICE (250): Normal but significant events., (*10)
-
WARNING (300): Exceptional occurrences that are not errors. Examples:
Use of deprecated APIs, poor use of an API, undesirable things that are not
necessarily wrong., (*11)
-
ERROR (400): Runtime errors that do not require immediate action but
should typically be logged and monitored., (*12)
-
CRITICAL (500): Critical conditions. Example: Application component
unavailable, unexpected exception., (*13)
-
ALERT (550): Action must be taken immediately. Example: Entire website
down, database unavailable, etc. This should trigger the SMS alerts and wake
you up., (*14)
-
EMERGENCY (600): Emergency: system is unusable., (*15)
Development
Clone, (*16)
$ git clone https://github.com/mikeevstropov/simple-logger.git
Go to project, (*17)
$ cd simple-logger
Install dependencies, (*18)
$ composer install
Run the tests, (*19)
$ composer test