port-adhoc/papertrail

This package is abandoned and no longer maintained. The author suggests using the khalyomede/syslog package instead.

Let you log in your papertrai log server

v1.0.7 2017-11-16 15:43 UTC

This package is not auto-updated.

Last update: 2022-02-01 13:10:15 UTC


README

This package is abandoned for a more reliable, standardized and tested package. Please refer to khalyomede/syslog as an alternative as this package will now loose its support.

papertrail-php

Let you log in your papertrail log server

Packagist

Requirements

  • You will need to activate the php_sockets extension by uncommenting the line in the php.ini file.
  • You will need to use Composer for this package.

Installation

Execute composer require port-adhoc/papertrail from the prompt command in your project folder.

Examples

Example of usage 1 : basic example

require( __DIR__ . '/vendor/autoload.php' );

use PortAdhoc\Papertrail;

Papertrail::host('example.papertrailapp.com')
  ->port(123456)
  ->facility(99)
  ->program('cron')
  ->component('spam-cleaning')
  ->message('hello world')
  ->severity( Papertrail::SEVERITY_DEBUG )
  ->send();

Refer to the Severity levels constants list for more severity levels.

back to the example list

Example of usage 2 : sending multiple message in one script

require( __DIR__ . '/vendor/autoload.php' );

use PortAdhoc\Papertrail;

Papertrail::host('example.papertrailapp.com')
  ->port(123456)
  ->facility(99)
  ->program('cron')
  ->component('spam-cleaning');

// a few moments later

Papertrail::message('fetching table done')
  ->severity( Papertrail::SEVERITY_DEBUG )
  ->send();

// an eternity later

Papertrail::message('cleaning table done')
  ->severity( Papertrail::SEVERITY_DEBUG )
  ->send();

Refer to the Severity levels constants list for more severity levels.

back to the example list

Known issues

Timezone error

If you ran into a similar error :

It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.

Please use date_default_timezone_set() to globally set your timezone.

Severity levels constants list

  • Papertrail::SEVERITY_EMERGENCY
  • Papertrail::SEVERITY_ALERT
  • Papertrail::SEVERITY_CRITICAL
  • Papertrail::SEVERITY_ERROR
  • Papertrail::SEVERITY_WARNING
  • Papertrail::SEVERITY_NOTICE
  • Papertrail::SEVERITY_INFORMATIONAL
  • Papertrail::SEVERITY_DEBUG