marciodojr/simple-logger

Simple psr3 Logger. Writes to log using PHP error_log.

v1.0.2 2018-03-18 01:19 UTC

This package is auto-updated.

Last update: 2022-07-18 19:51:02 UTC


README

Description

Just write messages to log using PHP error_log in the format:

Log[level]: message

Example:

Log[error]: Resource not created

How to install

composer require "marciodojr/simple-logger"

How to use

use Mdojr\Logger\SimpleLogger;
use Psr\Log\LogLevel;

$logger = new SimpleLogger();

$logger->log(LogLevel::ERROR, 'my log message'); // Log[error]: my log message
$logger->emergency(
    'emergency message {placeholder}', 
    ['placeholder' => 'with placeholders']
); // Log[emergency]: emergency message with placeholders

// ... any other log level specified by psr-3

How to test

    composer test

PSR-3 specification

https://www.php-fig.org/psr/psr-3/