<commit_before>"use strict";

const co        = require('co');
const qfs       = require('q-io/fs');
const directory = require('../lib/system/directory');
const constants = require('../lib/constants');
const path      = require('path');
const Tail      = require("tail").Tail

module.exports = {
  duniter: {

    cliOptions: [
      { value: '--loglevel <level>', desc: 'Logs level, either [error,warning,info,debug,trace]. default to `info`.' }
    ],

    config: {

      /*****
       * Tries to load a specific parameter `conf.loglevel`
       */
      onLoading: (conf, program) => co(function*(){
        conf.loglevel = program.loglevel || conf.loglevel || 'trace'
      })
    },

    cli: [{

      name: 'start',
      desc: 'Starts Duniter as a daemon (background task).',
      logs: false,
      onConfiguredExecute: (server, conf, program, params) => co(function*() {
        yield server.checkConfig()
        const daemon = server.getDaemon('direct_start', 'start')
        yield startDaemon(daemon)
      })
    }, {

      name: 'stop',
      desc: 'Stops Duniter daemon if it is running.',
      logs: false,
      onConfiguredExecute: (server, conf, program, params) => co(function*() {<commit_msg>[fix] #865 Default level to 'info'<commit_after>"use strict";

const co        = require('co');
const qfs       = require('q-io/fs');
const directory = require('../lib/system/directory');
const constants = require('../lib/constants');
const path      = require('path');
const Tail      = require("tail").Tail

module.exports = {
  duniter: {

    cliOptions: [
      { value: '--loglevel <level>', desc: 'Logs level, either [error,warning,info,debug,trace]. default to `info`.' }
    ],

    config: {

      /*****
       * Tries to load a specific parameter `conf.loglevel`
       */
      onLoading: (conf, program) => co(function*(){
        conf.loglevel = program.loglevel || conf.loglevel || 'info'
      })
    },

    cli: [{

      name: 'start',
      desc: 'Starts Duniter as a daemon (background task).',
      logs: false,
      onConfiguredExecute: (server, conf, program, params) => co(function*() {
        yield server.checkConfig()
        const daemon = server.getDaemon('direct_start', 'start')
        yield startDaemon(daemon)
      })
    }, {

      name: 'stop',
      desc: 'Stops Duniter daemon if it is running.',
      logs: false,
      onConfiguredExecute: (server, conf, program, params) => co(function*() {
{'fraction_non_alphanumeric': 0.16219512195121952, 'fraction_numerical': 0.0012195121951219512, 'mean_word_length': 2.6513353115727, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '3585278', 'n_tokens_mistral': 761, 'n_tokens_neox': 746, 'n_words': 195}