Download the PHP package camspiers/silverstripe-loggerbridge without Composer
On this page you can find all versions of the php package camspiers/silverstripe-loggerbridge. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download camspiers/silverstripe-loggerbridge
More information about camspiers/silverstripe-loggerbridge
Files in camspiers/silverstripe-loggerbridge
Package silverstripe-loggerbridge
Short Description Provides a bridge between PSR-3 loggers (like monolog) and SilverStripe
License MIT
Informations about the package silverstripe-loggerbridge
SilverStripe Logger Bridge
Provides easy usage of PSR-3
loggers (like monolog) in SilverStripe 3.x.
In SilverStripe 4.x and newer, PSR-3
support is built into the core system and this module is no longer required.
Installation (composer required)
$ composer require camspiers/silverstripe-loggerbridge:dev-master
Usage
- Create a config file in your
mysite
, e.g. "mysite/_config/logging.yml" -
Set up a
PSR-3
logger service and add to theLoggerBridge
constructorInjector: Monolog: class: Monolog\Logger constructor: 0: App 1: - '%$StreamHandler' StreamHandler: class: Monolog\Handler\StreamHandler constructor: 0: '../../error.log' LoggerBridge: class: Camspiers\LoggerBridge\LoggerBridge constructor: 0: '%$Monolog'
Changing the way errors display in development
By default Logger Bridge uses Whoops
for the display of errors and exceptions. You can change to using SilverStripe
error display by adding the following to your yml:
Injector:
LoggerBridge:
properties:
ErrorReporter: '%$LoggerBridgeDebugErrorReporter'
Advanced-style setup
This setup provides the following:
- Logging to a Sentry server, through a raven client (
composer require raven/raven
)- Uses one Sentry project for
live
and one Sentry project fortest
anddev
- Uses one Sentry project for
- Logging to a file for error levels
error
and above - Logging to Chrome Logger when environment
dev
- Errors are displayed in the Chrome console instead of displaying in the webpage
- Logging to FirePHP when environment
dev
- Errors are displayed in the Firebug console instead of displaying in the webpage
- Logging of peak memory usage along with error
Attaching the logger as early as possible
SilverStripe currently doesn't provide any way to replace the default Debug
error handlers prior to the
database connection etc. But the following patch will use the Logger Bridge as early as possible.
To apply the patch, run the following from the framework
directory of a 3.1.x-dev
install.
patch -p1 < framework.patch
framework.patch
Unit testing
Logger Bridge has good unit test converage. To run the unit tests:
$ composer install --dev --prefer-dist
$ phpunit
License
SilverStripe Logger Bridge is released under the MIT license
All versions of silverstripe-loggerbridge with dependencies
monolog/monolog Version ^1.7
filp/whoops Version ^2.0
silverstripe/framework Version ^3.1