<commit_before>'use strict'

const Trailpack = require('trailpack')
const lib = require('./lib')

/**
 * Core Trailpack
 *
 * Validate api, config, and pkg definitions; merge configuration setings; bind
 * event handlers/logging.
 */
module.exports = class Core extends Trailpack {

  validate () {
    this.app.log.info(this.app.config.motd.info.start)

    return Promise.all([
      lib.Validator.validatePackage(this.app.pkg),
      lib.Validator.validateConfig(this.app.config),
      lib.Validator.validateApi(this.app.api)
    ])
  }

  configure () {
    this.app.log = this.config.log.logger
  }

  /**
   * Listen for key app events, and bind context for API resources
   */
  initialize () {
    lib.Motd.bindMotdInitialize(this.app)

    this.app.controllers = lib.Context.bindMethods(this.app, 'controllers')
    this.app.policies = lib.Context.bindMethods(this.app, 'policies')
    this.app.services = lib.Context.bindMethods(this.app, 'services')
    this.app.models = lib.Context.bindMethods(this.app, 'models')

    return lib.i18n.init(this.app).then(i18n => {
      this.i18n = i18n
      this.app.__ = i18n.t
      this.app.emit('i18n:ready')
    })
  }

  constructor (app) {
    super(app, {
      config: require('./config'),
      pkg: require('./package')
    })

    if (!this.app.config.i18n) {
      this.app.config.i18n = { }
    }
    if (!this.app.config.log) {
      this.app.config.log = { }
    }
  }
}

<commit_msg>[config] do not set log property manually on app<commit_after>'use strict'

const Trailpack = require('trailpack')
const lib = require('./lib')

/**
 * Core Trailpack
 *
 * Validate api, config, and pkg definitions; merge configuration setings; bind
 * event handlers/logging.
 */
module.exports = class Core extends Trailpack {

  validate () {
    this.app.log.info(this.app.config.motd.info.start)

    return Promise.all([
      lib.Validator.validatePackage(this.app.pkg),
      lib.Validator.validateConfig(this.app.config),
      lib.Validator.validateApi(this.app.api)
    ])
  }

  configure () {
  }

  /**
   * Listen for key app events, and bind context for API resources
   */
  initialize () {
    lib.Motd.bindMotdInitialize(this.app)

    this.app.controllers = lib.Context.bindMethods(this.app, 'controllers')
    this.app.policies = lib.Context.bindMethods(this.app, 'policies')
    this.app.services = lib.Context.bindMethods(this.app, 'services')
    this.app.models = lib.Context.bindMethods(this.app, 'models')

    return lib.i18n.init(this.app).then(i18n => {
      this.i18n = i18n
      this.app.__ = i18n.t
      this.app.emit('i18n:ready')
    })
  }

  constructor (app) {
    super(app, {
      config: require('./config'),
      pkg: require('./package')
    })

    if (!this.app.config.i18n) {
      this.app.config.i18n = { }
    }
    if (!this.app.config.log) {
      this.app.config.log = { }
    }
  }
}


{'fraction_non_alphanumeric': 0.1520912547528517, 'fraction_numerical': 0.01106118216384376, 'mean_word_length': 2.8028909329829172, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1802681', 'n_tokens_mistral': 1010, 'n_tokens_neox': 973, 'n_words': 170}