nixilla/api-logger-bundle

API logger bundle help your app with API calls monitoring

0.3.2 2016-06-07 12:11 UTC

README

API logger bundle help your app with API calls monitoring.

https://travis-ci.org/nixilla/api-logger-bundle.svg?branch=master

Installation

Via composer:

{
    "require-dev": {
        "nixilla/api-logger-bundle": "~0.3"
    }
}

Add bundle to your AppKernel:

<?php

// app/AppKernel.php

if (in_array($this->getEnvironment(), array('dev', 'test'))) {
    // your other dev bundles here
    $bundles[] = new Nixilla\Api\LoggerBundle\NixillaApiLoggerBundle();
}

If you're use HWIOAuthBundle and you want to monitor all OAuth API calls, you can now override default hwi_oauth.http_client service used by this bundle by adding this few lines to your config_dev.yml file

# app/config/config_dev.yml
imports:
    - { resource: config.yml }

parameters:
    buzz.client.class: Nixilla\Api\LoggerBundle\Proxy\Buzz\Client\Curl

services:
    hwi_oauth.http_client:
        class: "%buzz.client.class%"
        calls:
            - [ "setLogger", [ "@nixilla.api.logger" ] ]

If you're using sensio/buzz-bundle, you may want to override the buzz.client in config_dev.yml

# app/config/config_dev.yml
imports:
    - { resource: config.yml }

parameters:
    buzz.client.class: Nixilla\Api\LoggerBundle\Proxy\Buzz\Client\Curl

services:
    buzz.client:
        class: "%buzz.client.class%"
        calls:
            - [ "setTimeout", [ "%buzz.client.timeout%" ] ]
            - [ "setLogger", [ "@nixilla.api.logger" ] ]