<commit_before>/*eslint-disable */
'use strict';

const pretty = require('prettyjson');
const chalk = require('chalk');
const time = require('../fn').getTime;

/**
 * Apply args to the `console[method]` & Add a date stamp.
 * Bind `this` to an object with the following options:
 *
 * @param  {String} args.date     The color string to use for the date
 * @param  {String} args.method   The `console` method to use
 * @param  {String} args.custom   The custom styling to append to args
 */
function stamp() {
	var args = [].slice.call(arguments)

	if (process.env.DEBUG) {
		return _.apply(_, args)
	}

	// print the curr time.
	process.stdout.write('[' + chalk[this.color](time()) + '] ')

	// apply arguments to `console` method
	console[this.method].apply(console, (this.custom ? [this.custom].concat(args) : args))
}

/**
 * Logging Utilities
 */

function log() {
	stamp.apply({method: 'log', color: 'magenta'}, arguments)
	return this
}

function error() {
	stamp.apply({method: 'error', color: 'red'}, arguments)
	return this
}

function alert() {
	if (process.env.VERBOSE) {
		stamp.apply({
			custom: chalk.yellow.bold('%s'),
			method: 'log',
			color: 'yellow'
		}, arguments)
	}
	return this
}

/**
 * PrettyJSON wrapper & stack tracer
 * @param  {Object} e   The Error object
 */
function trace(e) {
	var msg = pretty.render(e)
		.replace(/(\sFunction|\sObject)\./g, chalk.blue('$1') + '.')
		.replace(/\((~?\/.*)\)/g, '(' + chalk.gray('$1') + ')')
		.replace(/:([0-9]*):([0-9]*)/g, ' ' + chalk.yellow('$1') + ':' + chalk.yellow('$2'))
		.replace(new RegExp(process.env.HOME, 'g'), '~')
	console.error(msg)
}

module.exports = {
	trace: trace,
	alert: alert,
	error: error,
	log: log
};<commit_msg>minor logging adjustments; add @todo notes<commit_after>/* eslint prefer-spread:1 */
'use strict';

/**
 * @todo
 * 		- use 'fmt' object definitions
 * 		- use clean-stack trace?
 * 		- need prettyjson?
 * 		- use es2015
 */

const pretty = require('prettyjson');
const chalk = require('chalk');
const time = require('../fn').getTime;

/**
 * Apply args to the `console[method]` & Add a date stamp.
 * Bind `this` to an object with the following options:
 *
 * @param  {String} args.date     The color string to use for the date
 * @param  {String} args.method   The `console` method to use
 * @param  {String} args.custom   The custom styling to append to args
 */
function stamp() {
	const args = [].slice.call(arguments);

	// if (process.env.DEBUG) {
	// 	return _.apply(_, args);
	// }

	// print the curr time.
	process.stdout.write(`[${chalk[this.color](time())}]`);

	// apply arguments to `console` method
	console[this.method].apply(console, (this.custom ? [this.custom].concat(args) : args));
}

/**
 * Logging Utilities
 */

function log() {
	stamp.apply({method: 'log', color: 'magenta'}, arguments);
	return this;
}

function error() {
	stamp.apply({method: 'error', color: 'red'}, arguments);
	return this;
}

function alert() {
	if (process.env.VERBOSE) {
		stamp.apply({
			custom: chalk.yellow.bold('%s'),
			color: 'yellow',
			method: 'log'
		}, arguments);
	}
	return this;
}

/**
 * PrettyJSON wrapper & stack tracer
 * @param  {Object} e   The Error object
 */
function trace(e) {
	const msg = pretty.render(e)
		.replace(/(\sFunction|\sObject)\./g, `${chalk.blue('$1')}.`)
		.replace(/\((~?\/.*)\)/g, `(${chalk.gray('$1')})`)
		.replace(/:([0-9]*):([0-9]*)/g, ` ${chalk.yellow('$1')}:${chalk.yellow('$2')}`)
		.replace(new RegExp(process.env.HOME, 'g'), '~');
	console.error(msg);
}

module.exports = {
	trace: trace,
	alert: alert,
	error: error,
	log: log
};
{'fraction_non_alphanumeric': 0.20472878998609179, 'fraction_numerical': 0.0058414464534075105, 'mean_word_length': 3.6161745827984597, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7109081', 'n_tokens_mistral': 1342, 'n_tokens_neox': 1283, 'n_words': 323}