codingduck/monolog-plugin

This package is abandoned and no longer maintained. No replacement package was suggested.

Coding duck specific monolog logger implementation

1.0.4 2021-02-20 20:27 UTC

This package is auto-updated.

Last update: 2024-11-21 04:35:18 UTC


README

Simple monolog plugin to use with the coding duck's logging system.

Installation

composer require codingduck/monolog-plugin

Usage

Standalone

Standalone usage without any kind of framework.

use Codingduck\Logger\CodingDuckLogger;

$factory = new CodingDuckLogger;

$logger = $factory($config);

$logger->info("Hello world!");

Laravel / Lumen

Usage with Laravel/Lumen. Create or modify the file config/logging.php. If already exists just add a channel.

<?php
return [
    'default' => env('LOG_CHANNEL', 'codingDuck'),
    
    'channels' => [
        'codingDuck' => [
            'driver' => 'custom',
            'via' => \Codingduck\Logger\CodingDuckLogger::class,
            [... $config]
        ]
    ],
];

Configuration

All path are considered from the framework entry point

Project root

The project root parameter is used to convert the files in the stacktrace from an absolute to a relative path.

Example:

if projectRoot is /etc/projects/test/, the stacktrace goes from /etc/projects/test/App/Http/Controller/Test.php to /App/Http/Controller/Test.php