Skip to content

pointybeard/symext-logger_monolog

Repository files navigation

Monolog Logger Extension for Symphony CMS

A Monolog based logger that replaces the default logger in Symphony CMS.

Installation

This is an extension for Symphony CMS. Add it to the /extensions folder of your Symphony CMS installation, then enable it though the interface.

With Git and Composer

$ git clone --depth 1 https://github.com/pointybeard/symext-logger_monolog.git logger_monolog
$ composer update -vv --profile -d ./logger_monolog

After finishing the steps above, enable "Monolog Logger" though the administration interface or, if using Orchestra, with bin/extension enable logger_monolog.

With Orchestra

  1. Add the following extension defintion to your .orchestra/build.json file in the "extensions" block:
{
    "name": "logger_monolog",
    "repository": {
        "url": "https://github.com/pointybeard/symext-logger_monolog.git"
    }
}
  1. Run the following command to rebuild your Extensions
$ bin/orchestra build \
    --skip-import-sections \
    --database-skip-import-data \
    --database-skip-import-structure \
    --skip-create-author \
    --skip-seeders \
    --skip-git-reset \
    --skip-composer \
    --skip-postbuild

Basic Usage

After installation, enable this logger by going to your System Preferences and choosing "Monolog" from the "Logging" options.

Set Logging Level for StreamHandler

By default, the logging level for the default StreamHandler is WARNING. To change this, modify your config.json to include the following:

"logger_monolog": {
    "level": 100
},

Where level can be any of the supported logging levels.

Adding More Handlers

By default, the Monolog Logger adds a file stream handler to mimic the standard Symphony log that is created in manifest/logs/. However, additional handlers can be added by accessing the Monolog Logger instance via Symphony::Log()->getLogger(). E.g.

use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Symphony;

Symphony::Log()->getLogger()->pushHandler(new StreamHandler(
    LOGS . "/monolog.errors.log",
    Logger::ERROR
));

See the Monolog documentation for more on this.

About

Requirements

Dependencies

This extension depends on the following Composer libraries:

Support

If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.

Contributing

We encourage you to contribute to this project. Please check out the Contributing to this project documentation for guidelines about how to get involved.

Author

License

"Monolog Logger Extension for Symphony CMS" is released under the MIT License. See LICENCE for details.

About

A Monolog logger for Symphony CMS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages