hmoreira10/logsnag-logger

Canal de log personalizado do Laravel para envio ao LogSnag via HTTP

Installs: 296

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/hmoreira10/logsnag-logger

dev-main 2025-05-21 20:20 UTC

This package is not auto-updated.

Last update: 2025-12-18 02:08:23 UTC


README

A custom Laravel logging channel that sends logs directly to the LogSnag API via HTTP using Monolog.

Description

This package provides an easy way to integrate Laravel's logging system with LogSnag, allowing you to send structured log events directly to your LogSnag project. It leverages Monolog's custom handlers and Laravel's logging channels for seamless integration.

Installation

Install the package via Composer:

composer require hmoreira10/logsnag-logger:dev-main

Configuration

Add the custom log channel to your config/logging.php file:

'channels' => [
    // other channels...

    'logsnag-your-channel' => [
        'driver' => 'custom',
        'via' => LogSnag\Logger\LogSnagLogger::class,
        'level' => 'info',
        'token' => env('LOGSNAG_TOKEN'),
        'project' => env('LOGSNAG_PROJECT'),
        'channel' => 'your-channel'
    ],
],

Then add the required environment variables to your .env file:

LOGSNAG_TOKEN=your-logsnag-api-token
LOGSNAG_PROJECT=your-logsnag-project

Usage

Use the custom log channel in your Laravel application like this:

use Illuminate\Support\Facades\Log;

Log::channel('logsnag')->info('Important event happened', [
    'notify' => false
    'icon' => '💰',
]);

Notes

  • Logs are sent synchronously.
  • Customize notify, channel, and icon via context.
  • Requires Laravel 10+ and PHP 8.1+.

License

MIT License