'use strict';
var assert = require('assert');
var LogEntries = require('le_node');

function log () {
  // seneca custom log handlers

  if (process.env.LOGENTRIES_ENABLED === 'true') {
    assert.ok(process.env.LOGENTRIES_DEBUG_TOKEN, 'No LOGENTRIES_DEBUG_TOKEN set');
    var led = new LogEntries({
      token: process.env.LOGENTRIES_DEBUG_TOKEN,
      flatten: true,
      flattenArrays: true
    });

    assert.ok(process.env.LOGENTRIES_ERRORS_TOKEN, 'No LOGENTRIES_ERROR_TOKEN set');
    var lee = new LogEntries({
      token: process.env.LOGENTRIES_ERRORS_TOKEN,
      flatten: true,
      flattenArrays: true
    });
  }

  function debugHandler () {
    if (process.env.LOGENTRIES_ENABLED === 'true') {
      assert.ok(process.env.LOGENTRIES_DEBUG_TOKEN, 'No LOGENTRIES_DEBUG_TOKEN set');
      led.log('debug', arguments);
    }
  }

  function errorHandler () {
    console.error(JSON.stringify(arguments));

    if (process.env.LOGENTRIES_ENABLED === 'true') {
      assert.ok(process.env.LOGENTRIES_ERRORS_TOKEN, 'No LOGENTRIES_ERROR_TOKEN set');
      lee.log('err', arguments);
    }
  }

  return {
    map: [{
      level: 'debug', handler: debugHandler
    }, {
      level: 'error', handler: errorHandler
    }]
  };
}

var senecaOptions = {
  transport: {
    type: 'web',
    web: {
      timeout: 120000,
      port: 10305
    }
  },
  apiBaseUrl: process.env.BADGEKIT_API_BASE_URL || 'http://localhost:8080',
  apiSecret: process.env.BADGEKIT_API_SECRET || '',
  claimCodePrefix: 'code-',
  timeout: 120000,
  strict: { add: false, result: false },
  log: log()
};

module.exports = senecaOptions;

@@ -81,1165 +81,8 @@
 );%0A%0A
-function log () %7B%0A  // seneca custom log handlers%0A%0A  if (process.env.LOGENTRIES_ENABLED === 'true') %7B%0A    assert.ok(process.env.LOGENTRIES_DEBUG_TOKEN, 'No LOGENTRIES_DEBUG_TOKEN set');%0A    var led = new LogEntries(%7B%0A      token: process.env.LOGENTRIES_DEBUG_TOKEN,%0A      flatten: true,%0A      flattenArrays: true%0A    %7D);%0A%0A    assert.ok(process.env.LOGENTRIES_ERRORS_TOKEN, 'No LOGENTRIES_ERROR_TOKEN set');%0A    var lee = new LogEntries(%7B%0A      token: process.env.LOGENTRIES_ERRORS_TOKEN,%0A      flatten: true,%0A      flattenArrays: true%0A    %7D);%0A  %7D%0A%0A  function debugHandler () %7B%0A    if (process.env.LOGENTRIES_ENABLED === 'true') %7B%0A      assert.ok(process.env.LOGENTRIES_DEBUG_TOKEN, 'No LOGENTRIES_DEBUG_TOKEN set');%0A      led.log('debug', arguments);%0A    %7D%0A  %7D%0A%0A  function errorHandler () %7B%0A    console.error(JSON.stringify(arguments));%0A%0A    if (process.env.LOGENTRIES_ENABLED === 'true') %7B%0A      assert.ok(process.env.LOGENTRIES_ERRORS_TOKEN, 'No LOGENTRIES_ERROR_TOKEN set');%0A      lee.log('err', arguments);%0A    %7D%0A  %7D%0A%0A  return %7B%0A    map: %5B%7B%0A      level: 'debug', handler: debugHandler%0A    %7D, %7B%0A      level: 'error', handler: errorHandler%0A    %7D%5D%0A  %7D;%0A%7D%0A%0A
 var 
@@ -416,18 +416,34 @@
 ,%0A  
-log: log()
+actcache: %7B active:false %7D
 %0A%7D;%0A

Remove seneca logging (to be like all the other services)