phrity / logger-console
1.0.0
2025-08-26 15:51 UTC
Requires
- php: ^8.1
- phrity/util-interpolator: ^1.0
- phrity/util-transformer: ^1.3
- psr/log: ^1.0 | ^2.0 | ^3.0
- symfony/console: ^6.0 | ^7.0
Requires (Dev)
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^10.0 | ^11.0 | ^12.0
- robiningelbrecht/phpunit-coverage-tools: ^1.9
- squizlabs/php_codesniffer: ^3.5
Provides
- psr/log-implementation: 1.0 | 2.0 | 3.0
This package is not auto-updated.
Last update: 2025-08-27 15:41:17 UTC
README
Phrity Logger Console
A PSR-3 compatible console logger. Useful when running local tests and various console applications.
Installation
Install with Composer;
composer require phrity/logger-console
Verbosity
Verbosity level can be set on the logger.
use Phrity\Logger\Console\{ ConsoleLogger, Verbosity, }; $logger = new ConsoleLogger(verbosity: Verbosity::Verbose);
Available levels (default: Verbosity::Normal
);
Verbosity::Quiet
Verbosity::Normal
Verbosity::Verbose
Verbosity::VeryVerbose
Verbosity::Debug
Output format
Output format can be specified using string with replacers.
use Phrity\Logger\Console\ConsoleLogger; $logger = new ConsoleLogger(format: '{datetime} {level} {message} - {context}');
Available replacers;
datetime
- ISO datetime stringlevel
- Log level stringmessage
- Log message (interpolated)context
- String representation of context data
Default format is '{datetime} [{level}] {message}'
.
CLI options
By enabling CLI options, verbosity can be set as console argument.
use Phrity\Logger\Console\ConsoleLogger; $logger = new ConsoleLogger(cliOptions: true);
Available verbosity argument;
--quiet
-q--verbose=1
-v
--verbose=2
-vv
--verbose=3
-vvv
--debug
Versions
Version | PHP | |
---|---|---|
1.0 |
^8.1 |
Initial version |