You are here

function fb_instant_articles_init in Facebook Instant Articles 7

Same name and namespace in other branches
  1. 7.2 fb_instant_articles.module \fb_instant_articles_init()

Implements hook_init().

@todo Update to use a custom DrupalFBInstantArticlesLogger once this SDK issue is in resolved.

File

./fb_instant_articles.module, line 164
Hook implementations for Facebook Instant Articles Base module.

Code

function fb_instant_articles_init() {
  $enable_transformer_logging = variable_get('fb_instant_articles_enable_logging');
  $appender = array(
    'class' => $enable_transformer_logging ? '\\Drupal\\fb_instant_articles\\DrupalLoggerAppender' : 'LoggerAppenderNull',
    'layout' => array(
      'class' => 'LoggerLayoutSimple',
    ),
  );
  $configuration = array(
    'rootLogger' => array(
      'appenders' => array(
        'facebook-instantarticles-transformer',
        'facebook-instantarticles-client',
      ),
    ),
    'appenders' => array(
      'facebook-instantarticles-transformer' => $appender,
      'facebook-instantarticles-client' => $appender,
    ),
  );
  \Logger::configure($configuration);
}