Download the PHP package norsys/logs-bundle without Composer
On this page you can find all versions of the php package norsys/logs-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download norsys/logs-bundle
More information about norsys/logs-bundle
Files in norsys/logs-bundle
Package logs-bundle
Short Description Write logs in database and read logs with browser
License MIT
Informations about the package logs-bundle
Logs Bundle
This project is a bundle to write logs in database and read logs with browser
Installation
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php
file of your project:
Step 3: Configuration
First of all, you need to configure the Doctrine DBAL connection to use in the handler. You have 2 ways to do that:
By using an existing Doctrine connection:
Note: we set the logging
and profiling
option to false to avoid DI circular reference.
By creating a custom Doctrine connection for the bundle:
Please refer to the Doctrine DBAL connection configuration for more details.
Optionally you can override the schema table name (monolog_entries
by default):
Now your database is configured, you can generate the schema for your log entry table by running the following command:
Then, you can configure Monolog to use the Doctrine DBAL handler:
Now you have enabled and configured the handler, you migth want to display log entries, just import the routing file:
Translations
If you wish to use default translations provided in this bundle, make sure you have enabled the translator in your config:
Overriding default layout
You can override the default layout of the bundle by using the base_layout
option:
or quite simply with the Symfony way by create a template on app/Resources/NorsysLogsBundle/views/layout.html.twig
.
Using service tags to implement logger
This bundle comes up with a compiler pass helper, easing integration of the logger by using service tags when combined with LoggerAwareTrait.
First, use trait in your class:
Then update the class setup in your service container config:
That's it, now your logger is ready to use!:
Credits
Developped with :heart: by Norsys
License
This project is licensed under the MIT license.
All versions of logs-bundle with dependencies
symfony/symfony Version ~3.4
knplabs/knp-paginator-bundle Version ~2.5.3
monolog/monolog Version *
doctrine/dbal Version *
sensio/distribution-bundle Version ^5.0
composer/composer Version ^1.4