creamio/symfony_basebundle

Core bundle for CreamIO bundles in symfony

This package's canonical repository appears to be gone and the package has been frozen as a result. Email us for help if needed.

Maintainers

👁 QRaimbault

Package info

github.com/Cream-IO/symfony_basebundle

Type:symfony-bundle

pkg:composer/creamio/symfony_basebundle

Statistics

Installs: 155

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v0.5.0 2019-03-05 12:01 UTC

Suggests

None

Provides

None

Conflicts

None

Replaces

None

CC-BY-NC-SA-4.0 89637e2126726fcfba771e466cb6073d9843b604

  • QRaimbault

README

This bundle is a base for the CreamIO symfony bundles over Symfony 4.0.

Requirements

Installation

Require the bundle from a symfony 4 application.

You must configure the logger channel to log to database by modifying config/packages/(dev|prod)/monolog.yaml this way :

 channels: ['db']
 handlers:
 db:
 channels: ['db']
 type: service
 id: cream_io_base.loggingservice

You MUST NOT modify anything in this configuration, as the services are injected in the bundle for logger providing.

Usage

Autowire or inject CreamIO\BaseBundle\Service\LoggerProvider in your service/controller.
You can then log this way :

$logger = $loggerProvider->logger();
$logger->info('My information to log', ['userId', $user->getId()]); 

The second parameter is the context, it can be an array of whatever you want to identify the logging context.

Project tree

.
└── src
 ├── DependencyInjection
 ├── EventSubscriber # Exception event subscriber
 ├── Exceptions # APIError and APIException for error handling in API
 ├── Resources
 │   └── config # Service injection
 └── Service # API Service handling JSON responses

License

👁 Creative Commons License

This software is distributed under the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License. License is described below, you can find a human-readable summary of (and not a substitute for) the license here.