cre8-it/log-relay

Monolog log channel that posts structured log data over HTTP

Maintainers

Package info

github.com/cre8-it/log-relay

pkg:composer/cre8-it/log-relay

Transparency log

Statistics

Installs: 99

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-08-17 06:43 UTC

This package is auto-updated.

Last update: 2026-08-17 06:49:35 UTC


README

Log Relay for Laravel

Packagist PHP from Packagist Laravel versions GitHub Workflow Status (main) Total Downloads

Minimal Monolog log channel that posts structured log data over HTTP.

Installation

You can install the package via Composer:

composer require cre8-it/log-relay

Register the channel in config/logging.php:

use LogRelay\LogRelay\HttpHandler;

'channels' => [
    'stack' => [
        'driver' => 'stack',
        'channels' => ['single', 'http'],
    ],

    'http' => [
        'driver' => 'monolog',
        'handler' => HttpHandler::class,
        'level' => env('LOG_LEVEL', 'debug'),
        'handler_with' => [
            'url' => env('LOG_RELAY_URL', ''),
            'token' => env('LOG_RELAY_TOKEN', ''),
            'app' => env('LOG_RELAY_APP', ''),
            'async' => true,
        ],
    ],
],

Then set the connection values in your .env file:

LOG_RELAY_URL=
LOG_RELAY_TOKEN=
LOG_RELAY_APP=

app is sent with each record so the ingress can tell sources apart. If you omit it, the handler falls back to config('app.name').

Usage

Write logs as usual. Messages that reach the http channel are posted as JSON:

use Illuminate\Support\Facades\Log;

Log::error('Payment failed', ['order' => 42]);
Log::channel('http')->info('Invoice created');

Each request includes:

  • app, message, level, channel, datetime
  • context and extra (normalized so exceptions and objects are JSON-safe)
  • Authorization: Bearer {token} when a token is configured

Sync and async

async defaults to true. The HTTP call is deferred with Laravel's defer() helper and runs after the request or command has been handled, including failed requests.

Set async to false (or sync) to send immediately:

'async' => false,

Changelog

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

Contributing

Thank you for considering contributing to Log Relay for Laravel! Please review our contributing guide to get started.

Credits

License

Log Relay for Laravel is open-sourced software licensed under the MIT license.