pgtruesdell/laravel-logsnag

Logsnag's realtime monitoring + your Laravel project = 😎

1.2 2024-04-02 20:53 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package allows you to easily integrate Logsnag into your Laravel application.

Installation

You can install the package via composer:

composer require pgtruesdell/laravel-logsnag

You can publish the config file with:

php artisan vendor:publish --tag="laravel-logsnag-config"

This is the contents of the published config file:

return [
    /**
     * The project name.
     */
    'project' => env('LOGSNAG_PROJECT', 'my-laravel-app'),

    /**
     * The default channel name for the monolog driver.
     */
    'channel' => env('LOGSNAG_CHANNEL', 'app-events'),

    /**
     * Your logsnag API token.
     */
    'token' => env('LOGSNAG_TOKEN', ''),

    /**
     * A mapping of icons for logging.
     */
    'icons' => [
        'DEBUG'     => 'ℹ️',
        'INFO'      => 'ℹ️',
        'NOTICE'    => '📌',
        'WARNING'   => '⚠️',
        'ERROR'     => '⚠️',
        'CRITICAL'  => '🔥',
        'ALERT'     => '🔔️',
        'EMERGENCY' => '💀',
    ],
];

Usage

Using the built-in helper function:

logsnag(
    'app',
    'Artist Created',
    'Artist id 589 created by user 2',
    '🎨',
);

Using the facade:

use PGT\Logsnag\Facades\Logsnag;

Logsnag::log(
    channel: 'app',
    event: 'Artist Created',
    description: 'Artist id 589 created by user 2',
    icon: '🎨',
    notify: false
);

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.