<commit_before>'use strict'

// logger generator enabled on debug mode with tree-like structure
class ConsoleWriter {

  static labelLength = 11;
  head = '';

  constructor(type) {

    this.type = type;
    this.label = ConsoleWriter.getLabel(type);
    this.background = DEBUG[type].color;

  }

  indent() {

    this.head += '  ';

  }

  pipe() {

    this.head += ' |';

  }

  unindent() {

    this.head = this.head.slice(0,-2);

  }

  newline() {

    if (DEBUG[this.type].active) console.log('');

  }

  log(...a) {

    if (DEBUG[this.type].active)
      console.log(`%c ${this.label} %c`, `background: ${this.background}; color: white`, '', this.head, ...a);

  }

  static getLabel(text) {

    const gap = ConsoleWriter.labelLength - text.length;
    if (gap < 2) {

      return ` ${text.slice(0, gap-3)}. `;

    } else {

      return [
        space(Math.floor((ConsoleWriter.labelLength - text.length)/2)),
        text,
        space(Math.ceil((ConsoleWriter.labelLength - text.length)/2))
      ].join('');

    }

  }

}

Object.keys(DEBUG).forEach(type => ConsoleWriter[type] = new ConsoleWriter(type));

const $ = ConsoleWriter;<commit_msg>log label looks better by switching ceil and floor<commit_after>'use strict'

// logger generator enabled on debug mode with tree-like structure
class ConsoleWriter {

  static labelLength = 11;
  head = '';

  constructor(type) {

    this.type = type;
    this.label = ConsoleWriter.getLabel(type);
    this.background = DEBUG[type].color;

  }

  indent() {

    this.head += '  ';

  }

  pipe() {

    this.head += ' |';

  }

  unindent() {

    this.head = this.head.slice(0,-2);

  }

  newline() {

    if (DEBUG[this.type].active) console.log('');

  }

  log(...a) {

    if (DEBUG[this.type].active)
      console.log(`%c ${this.label} %c`, `background: ${this.background}; color: white`, '', this.head, ...a);

  }

  static getLabel(text) {

    const gap = ConsoleWriter.labelLength - text.length;
    if (gap < 2) {

      return ` ${text.slice(0, gap-3)}. `;

    } else {

      return [
        space(Math.ceil((ConsoleWriter.labelLength - text.length)/2)),
        text,
        space(Math.floor((ConsoleWriter.labelLength - text.length)/2))
      ].join('');

    }

  }

}

Object.keys(DEBUG).forEach(type => ConsoleWriter[type] = new ConsoleWriter(type));

const $ = ConsoleWriter;
{'fraction_non_alphanumeric': 0.17376634331505694, 'fraction_numerical': 0.007591733445803458, 'mean_word_length': 2.588502269288956, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6405252', 'n_tokens_mistral': 836, 'n_tokens_neox': 771, 'n_words': 153}