jeremyharris / psr3-papertrail
PSR-3 logger for Papertrail
Installs: 3 113
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- psr/log: ^1.0.0
Requires (Dev)
- phpunit/phpunit: ^5.7.0
- squizlabs/php_codesniffer: ^3.0
This package is not auto-updated.
Last update: 2024-11-10 03:04:43 UTC
README
PSR-3 Papertrail Logger
This is a PSR-3 compatible logger that logs to Papertrail.
Installation
composer require jeremyharris/psr3-papertrail
To log to Papertrail, you must define the following constants with your Papertrail credentials:
PAPERTRAIL_HOST
: Your Papertrail hostPAPERTRAIL_PORT
: Your Papertrail port
Usage
define('PAPERTRAIL_HOST', 'example.papertrailapp.com'); define('PAPERTRAIL_PORT', 1234); $logger = new \JeremyHarris\Papertrail\Logger; $logger->log('error', 'An error occured');
For more information about PSR-3 logging, visit the PSR-3 recommendation.
This package contains the \Psr\Log\LogLevel
class for friendly log level
constants.
Note: Logs are transported over UDP and are therefore fast but fail silently.
Context Options
While no context options are required, you can pass a program and hostname to manually define them.
string $program
: Program to use. Uses'logger'
by default.string $hostname
: Hostname to use. Usesgethostname()
by defaultstring $facility
: Facility to use. Uses local0 (16) by default. See RFC 3164 for details
This code was mostly taken from the Papertrail docs and this gist.