Skip to content

Minimal implementation of Yii2 log target sending messages to Papertrail

License

Notifications You must be signed in to change notification settings

rekurzia/yii2-papertrail-log-target

Repository files navigation

Yii2 Papertrail log target

Build Status Latest Stable Version Total Downloads License

Yii2 log target which sends log messages to Papertrail.

Installation

composer require rekurzia/yii2-papertrail-log-target

Usage

Add new target to your configuration:

$config['components']['log']['targets'] = [
    [
        'class' => Rekurzia\Log\PapertrailTarget::class,
        'levels' => ['error', 'warning'],
        'host' => 'logs[xxx].papertrailapp.com',
        'port' => '1234',
        'additionalPrefix' => function() {
            return Yii::$app->id;
        },
    ],
];

Configuration options

host and port

Host and port of your Papertrail log destination.

additionalPrefix

Optional. A PHP callable which allows you to add additional prefix. Useful when [ip][userI][sessionId] is not enough. Setting as in example above, additional prefix [yourApplicationId] will be added.

includeContextMessage

Optional. Whether to include also context message. Defaults to false.

Sample output

Sample output screenshot

Usage of additionalPrefix highlighted.

License

MIT. See license file.

About

Minimal implementation of Yii2 log target sending messages to Papertrail

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages