phpgenesis/logger

Logger for PHPGenesis

v0.2.12 2024-05-24 14:55 UTC

This package is auto-updated.

Last update: 2024-05-24 14:57:04 UTC


README

The PHPGenesis Logger is an abstraction layer on top of the Laravel Log Facade and Monolog.

Installation

To install the Logger package, you can use Composer:

composer require phpgenesis/logger

Usage

To log a message, use the PHPGenesis\Logger\Logger class.

use PHPGenesis\Logger\Logger;

The following methods are available for you to use via Logger:

$message = 'This is an example logger message';

Logger::debug($message);
Logger::info($message);
Logger::notice($message);
Logger::warning($message);
Logger::error($message);
Logger::critical($message);
Logger::alert($message);
Logger::emergency($message);

All methods all accept an additional optional parameter for context data. The context data must be an array and defaults to an empty array if not supplied

The Logger class will determine if the Laravel Log Facade is available and use it, otherwise it will use Monolog. If Laravel is available, the Logger class will use the Laravel configuration settings for logging. Otherwise, Logger will use the settings configured in your phpgenesis.json file.