<commit_before>'use strict'
// logging to stderr, to avoid conflict with stdin pipeline ...
var sm = require('stackman')
var stackman = sm({sync:true})

var path = require('path')
var DEBUG=3
var INFO=2
var WARN=1
var ERROR=0
var chalk = require('chalk')

function logWithNodeModuleInfo (level, text) {
 	var e = new Error('Oops!')
 	var stack = stackman(e)
  	var mi = path.basename(stack.frames[3].getFileName()) + ':'+ stack.frames[3].getLineNumber()
	switch (level) {
	  	case ERROR: 
	  		console.error(chalk.bgRed('%s %s'), new Date().toISOString(),text)
	  		break;
	  	case WARN:  
	  		console.error(chalk.bgYellow('%s %s'), new Date().toISOString(),text)
	  		break;
	  	case DEBUG:  
	  		console.error(chalk.bgBlue('%s %s'), new Date().toISOString(),text);
	  		break;
	  	default:  
	  		console.error(chalk.bgBlack.green('%s %s'), new Date().toISOString(),text);
	  		break; 
  	  }		
}

function logToConsole(level, text) {
	if (process.env.DEBUG) {
		logWithNodeModuleInfo(level,text)	
	} else {
	  switch (level) {
	  	case ERROR: 
	  		console.error(chalk.bgRed('%s %s'), new Date().toISOString(),text)
	  		break;
	  	case WARN:  <commit_msg>print module and line numbers when env var DEBUG is set<commit_after>'use strict'
// logging to stderr, to avoid conflict with stdin pipeline ...
var sm = require('stackman')
var stackman = sm({sync:true})

var path = require('path')
var DEBUG=3
var INFO=2
var WARN=1
var ERROR=0
var chalk = require('chalk')

function logWithNodeModuleInfo (level, text) {
 	var e = new Error('Oops!')
 	var stack = stackman(e)
  	var mi = path.basename(stack.frames[3].getFileName()) + ':'+ stack.frames[3].getLineNumber() + ' '
	switch (level) {
	  	case ERROR: 
	  		console.error(chalk.bgRed('%s %s'), new Date().toISOString(), mi + text)
	  		break;
	  	case WARN:  
	  		console.error(chalk.bgYellow('%s %s'), new Date().toISOString(),mi + text)
	  		break;
	  	case DEBUG:  
	  		console.error(chalk.bgBlue('%s %s'), new Date().toISOString(),mi + text);
	  		break;
	  	default:  
	  		console.error(chalk.bgBlack.green('%s %s'), new Date().toISOString(),mi + text);
	  		break; 
  	  }		
}

function logToConsole(level, text) {
	if (process.env.DEBUG) {
		logWithNodeModuleInfo(level,text)	
	} else {
	  switch (level) {
	  	case ERROR: 
	  		console.error(chalk.bgRed('%s %s'), new Date().toISOString(),text)
	  		break;
	  	case WARN:  
{'fraction_non_alphanumeric': 0.16269343370974487, 'fraction_numerical': 0.005018820577164366, 'mean_word_length': 3.5561904761904763, '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': '6148159', 'n_tokens_mistral': 936, 'n_tokens_neox': 879, 'n_words': 201}