stein/monolog-railway-formatter

A Monolog extension for formatting log entries for Railway.app

1.0.1 2024-08-27 12:58 UTC

This package is auto-updated.

Last update: 2024-10-12 09:17:47 UTC


README

This is a custom formatter for Monolog that formats log messages in a way that is compatible with the Railway.app log format.

Requirements

  • PHP 8.1 or higher

Installation

composer require stein/monolog-railway-formatter

Usage

use Monolog\Level;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Stein\Monolog\Formatter\RailwayFormatter;

$logger = new Logger('MyLogger', [
    new StreamHandler('php://stderr', Level::Error, false),
    new StreamHandler('php://stdout', Level::Debug)
])->setFormatter(new RailwayFormatter());

License

This project is licensed under the MIT License - see the LICENSE file for details.