Download the PHP package illuminated/console-logger without Composer

On this page you can find all versions of the php package illuminated/console-logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package console-logger

Laravel Console Logger

Buy me a coffee

StyleCI Build Status Coverage Status

Packagist Version Packagist Stars Packagist Downloads Packagist License

Logging and Notifications for Laravel Console Commands.

Laravel Console Logger
12.x 12.x
11.x 11.x
10.x 10.x
9.x 9.x
8.x 8.x
7.x 7.x
6.x 6.x
5.8.* 5.8.*
5.7.* 5.7.*
5.6.* 5.6.*
5.5.* 5.5.*
5.4.* 5.4.*
5.3.* 5.3.*
5.2.* 5.2.*
5.1.* 5.1.*

Table of contents

Usage

  1. Install the package via Composer:

  2. Use Illuminated\Console\Loggable trait:

  3. Run the command and check your logs:

Available methods

The Loggable trait provides these PSR-3 methods:

Use them in your console commands to log required information.

Channels

Log messages could be handled in multiple different ways.

It might be writing data into the log file, storing it in the database, sending an email, etc.

File channel

File channel simply writes log messages into the log file.

Each of the commands would have a separate folder within the storage/logs dir.

For example, foo-bar command logs would be stored in the storage/logs/foo-bar folder.

You can customize the storage folder, and the max number of stored log files by overriding proper methods:

Notification channels

If you want to be notified about errors in your console commands - use notification channels.

Notification channels are optional and disabled by default. Each of them could be enabled and configured as needed.

By default, you'll get notifications with a level higher than NOTICE (see PSR-3 log levels). It means that you'll get NOTICE, WARNING, ERROR, CRITICAL, ALERT, and EMERGENCY notifications, by default.

Of course, you can customize that, as well as other channel-specific details.

Email channel

The email channel provides notifications via email.

Set the recipients, and email notifications are ready to go!

There's a bunch of methods related to the email channel.

By overriding those methods, you can change the subject, from address, notification level, etc.

Deduplication is another useful feature worth mentioning. Sometimes the same error might occur many times in a row. For example, you're using an external web service that is down. Or imagine that the database server goes down. You'll get a lot of similar emails in those cases. Deduplication is the right solution for that.

You can enable it and adjust the time in seconds, for which deduplication works:

Database channel

The database channel provides a way to save notifications in the database.

The easiest way to start using it:

Notifications would be stored in the iclogger_notifications table, which would be automatically created if it doesn't exist yet.

Of course, you can customize the table name, and even the saving logic, by overriding proper methods:

Error handling

Another cool feature that is enabled by default - is error handling.

The package automatically logs everything for you: severe problems - exceptions and fatal errors, and even small things, such as PHP notices and warnings.

Add notifications to that, and you'll immediately know when something goes wrong in your console commands!

Exceptions with context

Sometimes it's useful to pass an additional context of the thrown exception.

Use the Illuminated\Console\Exceptions\RuntimeException for that:

Guzzle 6+ integration

If you're using Guzzle, you might want to have a full log of your HTTP interactions.

The iclogger_guzzle_middleware() function provides a pre-configured Guzzle Middleware for that:

If you're using JSON, you might want to get auto decoding for your request params and response bodies:

Also, you can disable logging of specific request params and/or response bodies, based on your custom logic:

Powered by Monolog

This package uses the powerful Monolog Logger.

You can access the underlying instance of Monolog by:

Troubleshooting

Trait included, but nothing happens?

Loggable trait overrides the initialize() method:

If your command overrides the initialize() method too, you have to call the initializeLogging() method by yourself:

Several traits conflict?

If you're using another illuminated/console-% package, you'll get the "traits conflict" error.

For example, if you're building a loggable command, which doesn't allow overlapping:

You'll get the traits conflict, because both of those traits are overriding the initialize() method:

If two traits insert a method with the same name, a fatal error is produced, if the conflict is not explicitly resolved.

To fix that - override the initialize() method and resolve the conflict:

Sponsors



License

Laravel Console Logger is open-sourced software licensed under the MIT license.

Buy me a coffee 


All versions of console-logger with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/console Version ^12.0
illuminate/support Version ^12.0
illuminated/helper-functions Version ^12.0
monolog/monolog Version ^3.0
psr/http-message Version ^1.0
psr/log Version ^1.0|^2.0|^3.0
symfony/finder Version ^7.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package illuminated/console-logger contains the following files

Loading the files please wait ....