Skip to content

davidecesarano/Embryo-Logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Embryo Logger

Minimalist and fast PSR-3 Stream logger.

Requirements

Installation

Using Composer:

$ composer require davidecesarano/embryo-logger

Usage

Set log directory and create logger object. You can set emergency, alert, critical, error, warning, notice, info, debug and log message.

use Embryo\Log\StreamLogger;

$logPath = __DIR__.DIRECTORY_SEPARATOR.'logs';
$logger  = new StreamLogger($logPath);

$message = "User {username} created";
$context = ['username' => 'bolivar'];

// info log
$logger->info($message, $context);

This example writes User bolivar created in the info.log file.

You may quickly test this using the built-in PHP server going to http://localhost:8000.

$ cd example
$ php -S localhost:8000

About

Minimalist and fast PSR-3 Stream logger.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages