PHPackages                             stagerightlabs/command-line-logger - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. stagerightlabs/command-line-logger

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

stagerightlabs/command-line-logger
==================================

Write log messages to the command line while respecting output verbosity

v1.0.1(1y ago)0543Apache-2.0PHPPHP ^8.2

Since Feb 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/stagerightlabs/command-line-logger)[ Packagist](https://packagist.org/packages/stagerightlabs/command-line-logger)[ Docs](https://github.com/stagerightlabs/command-line-logger)[ RSS](/packages/stagerightlabs-command-line-logger/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (4)Used By (0)

[![Write Laravel log messages to the console](https://camo.githubusercontent.com/9174ccbdd6be37a8f3460688b2013c3226130c67e355310c4c997b671d8baf7f/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f436f6d6d616e642532304c696e652532304c6f676765722e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d737461676572696768746c616273253246636f6d6d616e642d6c696e652d6c6f67676572267061747465726e3d67726170685061706572267374796c653d7374796c655f31266465736372697074696f6e3d57726974652b6c6f672b6d657373616765732b746f2b7468652b636f6e736f6c652b7768696c652b72657370656374696e672b6f75747075742b766572626f73697479266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)](https://camo.githubusercontent.com/9174ccbdd6be37a8f3460688b2013c3226130c67e355310c4c997b671d8baf7f/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f436f6d6d616e642532304c696e652532304c6f676765722e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d737461676572696768746c616273253246636f6d6d616e642d6c696e652d6c6f67676572267061747465726e3d67726170685061706572267374796c653d7374796c655f31266465736372697074696f6e3d57726974652b6c6f672b6d657373616765732b746f2b7468652b636f6e736f6c652b7768696c652b72657370656374696e672b6f75747075742b766572626f73697479266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)

Write log messages to the command line while respecting output verbosity
========================================================================

[](#write-log-messages-to-the-command-line-while-respecting-output-verbosity)

Artisan commands accepts 'verbosity' level flags which indicate the level of desired output: `-v`, `-vv` and `-vvv`. These come from the underlying Symfony/Console package and are often overlooked in the Laravel ecosystem. Respecting verbosity can be rather cumbersome and adds noise to your code:

```
if ($this->getOutput()->isDebug()) {
    $this->info('To an old pond');
}

if ($this->getOutput()->isVeryVerbose()) {
    $this->info('A frog leaps in');
}

if ($this->getOutput()->isVerbose()) {
    $this->info('And the sound of the water');
}

$this->info('- Matsu Basho');
```

The goal of this package is to streamline command output while still respecting verbosity flags. We do that by creating a `console` log channel and sending log messages to the command line rather than using the native Artisan output helpers such as `info()` and `error()`.

With this package installed and configured, the above example would instead look like this:

```
Log::debug('To an old pond');
Log::info('A frog leaps in');
Log::notice('And the sound of the water');
Log::warning('- Matsu Basho');
```

When you call the command those messages would appear in the console output based on the verbosity flag provided:

LevelVerbosityErrorQuietWarningNormalNoticeVerboseInfoVery VerboseDebugDebugWhen combined with a log stack the output will also be logged to those other channels as well, which is an added bonus.

This package is an implementation of the Symfony Monolog Bridge [Console Handler](https://symfony.com/doc/current/logging/monolog_console.html) for Laravel.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require stagerightlabs/command-line-logger
```

Make sure you do not have an existing log channel called "console" otherwise there may be conflicts.

After installing the package you will need to add the "console" destination channel to your logging config. This can be done in a `.env` file:

```
LOG_CHANNEL=stack
LOG_STACK=single,console

```

You could also make this change in the `config/logging.php` file:

```
'stack' => [
    'driver' => 'stack',
    'channels' => ['single', 'console'],
    'ignore_exceptions' => false,
],
```

You don't need to use the "console" channel with a stack but it can be helpful.

Usage
-----

[](#usage)

Instead of writing console output directly from the Artisan command, you should now write to the logs instead:

```
// Instead of this
$this->info('Matsu Basho');

// Do this
Log::info('Matsu Basho');
```

These messages will appear in the console depending on the log level and the verbosity settings given to the command. See the above table for more details.

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

The original idea comes from the [Symfony Monolog Bridge](https://github.com/symfony/symfony/blob/727ae99526ed907e5abc5e8ee59187c2139b1096/src/Symfony/Bridge/Monolog/Handler/ConsoleHandler.php). More information in [the Symfony Docs](https://symfony.com/doc/current/logging/monolog_console.html).

For this version:

- [Ryan C. Durham](https://github.com/stagerightlabs)
- [All Contributors](../../contributors)

License
-------

[](#license)

The Apache License 2. Please see [License File](LICENSE.md) for more information.

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance44

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~24 days

Total

2

Last Release

444d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/97d8f58fda6a474519e876ece356e8246390e4e7f3b2c56ee8ec6bc1e88cfa6b?d=identicon)[Stage Right Labs](/maintainers/Stage%20Right%20Labs)

---

Top Contributors

[![rydurham](https://avatars.githubusercontent.com/u/674347?v=4)](https://github.com/rydurham "rydurham (4 commits)")

---

Tags

consolelaravelloggingcommand-linelaravellogginglogger

### Embed Badge

![Health badge](/badges/stagerightlabs-command-line-logger/health.svg)

```
[![Health](https://phpackages.com/badges/stagerightlabs-command-line-logger/health.svg)](https://phpackages.com/packages/stagerightlabs-command-line-logger)
```

###  Alternatives

[marvinlabs/laravel-discord-logger

Logging to a discord channel in Laravel

2081.1M2](/packages/marvinlabs-laravel-discord-logger)[honeybadger-io/honeybadger-laravel

Honeybadger Laravel integration

431.2M](/packages/honeybadger-io-honeybadger-laravel)[illuminated/console-logger

Logging and Notifications for Laravel Console Commands.

8674.9k](/packages/illuminated-console-logger)[shaffe/laravel-mail-log-channel

A package to support logging via email in Laravel

1286.2k](/packages/shaffe-laravel-mail-log-channel)[onlime/laravel-http-client-global-logger

A global logger for the Laravel HTTP Client

1935.1k](/packages/onlime-laravel-http-client-global-logger)[yzen.dev/mono-processor

This Processor will display in the logs bread crumbs by which you can more quickly and accurately identify the cause of the error.

116.1k](/packages/yzendev-mono-processor)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
