<commit_before>/*jslint node: true */
'use strict';

var events = require('events');
var util = require('util');
var Transport = require('winston').Transport;

var EventLogger;
try {
	var nodeWindows = require('node-windows');
	EventLogger = nodeWindows.EventLogger;
}
catch ( err ) {
}


var EventLog = function (options) {
	Transport.call(this, options);
	options = options || {};

	this.name		 = 'eventlog';
	this.eventLog	 = options.eventLog || "application"; //system is also valid.
	this.source	= options.source || "node"; //system is also valid
	this.json		 = options.json		|| false;
	this.timestamp = typeof options.timestamp !== 'undefined' ? options.timestamp : false;

	if ( EventLogger ) {
		this.logger = new EventLogger(this.source, this.eventLog);
	}

	if (this.json) {
		this.stringify = options.stringify || function (obj) {
			return JSON.stringify(obj, null, 2);
		};
	}
};

util.inherits(EventLog, Transport);


EventLog.prototype.log = function (level, msg, meta, callback) {
	if (this.silent || !this.logger) {
		return callback(null, true);
	}

	var message = msg + (meta ? ("\r\n\r\n" + "metadata: " + JSON.stringify(meta, null, 2)) : "");

	switch ( level ) {
		default:
		case "info":
			this.logger.info(message);
			break;
		case "warning":
			this.logger.warn(message);
			break;
		case "error":
			this.logger.error(message);
			break;
	}
	
	this.emit('logged');

	callback(null, true);
};

exports.EventLog = EventLog;

exports.config = {
	levels: {
		info: 0,
		warning: 1,
		error: 2
	},
	colors: {
		info: 'green',
		warning: 'yellow',
		error: 'red'
	}
};
<commit_msg>Tidy up<commit_after>/*jslint node: true */
'use strict';

var util = require('util');
var Transport = require('winston').Transport;

var EventLogger;
try {
	var nodeWindows = require('node-windows');
	EventLogger = nodeWindows.EventLogger;
}
catch ( err ) {
}


var EventLog = function (options) {
	Transport.call(this, options);
	options = options || {};

	this.name = 'eventlog';

	if ( EventLogger ) {
		var eventLog = options.eventLog || "application"; //system is also valid.
		var source = options.source || "node"; //system is also valid
		this.logger = new EventLogger(source, eventLog);
	}
};

util.inherits(EventLog, Transport);


EventLog.prototype.log = function (level, msg, meta, callback) {
	if (this.silent || !this.logger) {
		return callback(null, true);
	}

	var message = msg + (meta ? ("\r\n\r\n" + "metadata: " + JSON.stringify(meta, null, 2)) : "");

	switch ( level ) {
		default:
		case "info":
			this.logger.info(message);
			break;
		case "warning":
			this.logger.warn(message);
			break;
		case "error":
			this.logger.error(message);
			break;
	}
	
	this.emit('logged');

	callback(null, true);
};

module.exports = EventLog;

{'fraction_non_alphanumeric': 0.16769286490402027, 'fraction_numerical': 0.0021731256791017745, 'mean_word_length': 3.7620689655172415, 'pattern_counts': {'":': 6, '<': 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': '6681450', 'n_tokens_mistral': 1014, 'n_tokens_neox': 936, 'n_words': 228}