davidecesarano / embryo-logger
Minimalist and fast PSR-3 Stream logger.
Installs: 119
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/davidecesarano/embryo-logger
Requires
- php: >=7.1
- davidecesarano/embryo-http: dev-master
- psr/log: 1.0.2
Requires (Dev)
- phpstan/phpstan: ^0.12.54
This package is auto-updated.
Last update: 2025-10-09 00:10:01 UTC
README
Minimalist and fast PSR-3 Stream logger.
Requirements
- PHP >= 7.1
- A PSR-7 http message implementation and PSR-17 http factory implementation (ex. Embryo-Http)
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