Download the PHP package crazyfactory/phalcon-loggers without Composer
On this page you can find all versions of the php package crazyfactory/phalcon-loggers. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download crazyfactory/phalcon-loggers
More information about crazyfactory/phalcon-loggers
Files in crazyfactory/phalcon-loggers
Package phalcon-loggers
Short Description Phalcon logging adapters for Slack and Sentry.
License MIT
Informations about the package phalcon-loggers
phalcon-loggers
A collection of configurable logging adapters with logging functionality loosely PSR compatible for phalcon 3.x and PHP 7.x. Currently the following adapters are implemented:
Sentry
- Depends on the sentry/sentry package.
- You have to run
composer require sentry/sentry
- You might have to require
Raven_Autoloader
as explained here (see #installation section below) - Disabled by default but is active if class
Raven_Client
is defined.
Slack
- Self contained and ready to work out of the box.
... and we plan to add a few more!
Installation
It is a fully composer ready library. Just run:
If you have not used composer's autoloading (i.e. require 'vendor/autoload.php'
) &/or just want to use phalcon's native autoloader:
If you want to use Sentry as well:
If you have not used composer's autoloading, then setup autoloading of Raven_
classes like so:
Usage
The easiest and quickest way to use this library is by using the supplied Service
:
See examples for details and various integration samples. Also see the API section.
Configuration
You can pass in configuration as an array or a file
The loggers have their own configuration options but share common parameter requestId
and environment
.
Here is how a typical configuration looks like for slack and sentry both:
API
All the loggers inherit from base phalcon logger adapter so they automatically inherit public callable APIs from the base. In addition the loggers may also expose some APIs available for direct call.
Sentry:
Sentry logger has following public APIs:
-
addCrumb(string $message, string $category = 'default', array $data = [], int $type = null)
-
setTag(string $key, string $value)
-
setUserContext(array $context)
-
setExtraContext(array $context)
-
getLastEventId()
- logException(\Throwable $exception, array $context = [], int $type = null)
All versions of phalcon-loggers with dependencies
ext-phalcon Version ^3.0
ext-json Version *