<commit_before>--[[
Copyright 2012 Rackspace

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--]]

local logging = require('logging')

local Entry = {}

local argv = require("options")
  .usage('Usage: ')
  .describe("i", "use insecure tls cert")
  .describe("i", "insecure")
  .describe("e", "entry module")
  .describe("s", "state directory path")
  .describe("c", "config file path")
  .describe("p", "pid file path")
  .describe("d", "enable debug logging")
  .describe("u", "setup")
  .alias({['u'] = 'setup'})
  .describe("n", "username")
  .alias({['n'] = 'username'})
  .describe("k", "apikey")
  .alias({['k'] = 'apikey'})
  .argv("idhe:p:c:s:n:k:u")

function Entry.run()
  local mod = argv.args.e and argv.args.e or 'default'
  mod = './modules/monitoring/' .. mod

  if argv.args.d then
    logging.set_level(logging.EVERYTHING)
  else
    logging.set_level(logging.INFO)
  end
  logging.debugf('Running Module %s', mod)

  local err, msg = pcall(function()
    require(mod).run(argv.args)
  end)

  if err == false then
    logging.error(msg)
  end
end

return Entry<commit_msg>Exit 1 on failure to load<commit_after>--[[
Copyright 2012 Rackspace

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--]]

local logging = require('logging')

local Entry = {}

local argv = require("options")
  .usage('Usage: ')
  .describe("i", "use insecure tls cert")
  .describe("i", "insecure")
  .describe("e", "entry module")
  .describe("s", "state directory path")
  .describe("c", "config file path")
  .describe("p", "pid file path")
  .describe("d", "enable debug logging")
  .describe("u", "setup")
  .alias({['u'] = 'setup'})
  .describe("n", "username")
  .alias({['n'] = 'username'})
  .describe("k", "apikey")
  .alias({['k'] = 'apikey'})
  .argv("idhe:p:c:s:n:k:u")

function Entry.run()
  local mod = argv.args.e and argv.args.e or 'default'
  mod = './modules/monitoring/' .. mod

  if argv.args.d then
    logging.set_level(logging.EVERYTHING)
  else
    logging.set_level(logging.INFO)
  end
  logging.debugf('Running Module %s', mod)

  local err, msg = pcall(function()
    require(mod).run(argv.args)
  end)

  if err == false then
    logging.error(msg)
    process.exit(1)
  end
end

return Entry
{'fraction_non_alphanumeric': 0.14930555555555555, 'fraction_numerical': 0.005681818181818182, 'mean_word_length': 3.9515625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2980684', 'n_tokens_mistral': 1053, 'n_tokens_neox': 1003, 'n_words': 339}