<commit_before>const system = require('system');

/* eslint-disable no-console */
/* globals phantom:false */

if (system.args.length !== 2) {
	console.log('Usage: phantom.js <URL>');
	phantom.exit(1);
}

const page = require('webpage').create();
phantom.onError = page.onError = function(err) {
	console.log(err);
	phantom.exit(1);
};

page.open(system.args[1], function(status) {
	if (status !== 'success') {
		console.log('Cannot load the page');
		phantom.exit(1);
	}
	phantom.exit(0);
});<commit_msg>Chore: Try to add more logging to PhantomJS script<commit_after>const system = require('system');

/* eslint-disable no-console */
/* globals phantom:false */

if (system.args.length !== 2) {
	console.log('Usage: phantom.js <URL>');
	phantom.exit(1);
}

const page = require('webpage').create();
phantom.onError = page.onError = page.onResourceError = page.onResourceTimeout = function(err) {
	console.log(err);
	phantom.exit(1);
};

page.onConsoleMessage = function(msg) {
	console.log(msg);
};

page.viewportSize = { width: 1024, height: 768 };

page.open(system.args[1], function(status) {
	// page.render('screenshot.png');
	if (status !== 'success') {
		console.log('Cannot load the page');
		phantom.exit(1);
	}
	phantom.exit(0);
});
{'fraction_non_alphanumeric': 0.1937299035369775, 'fraction_numerical': 0.01527331189710611, 'mean_word_length': 4.817757009345795, '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': '5347204', 'n_tokens_mistral': 464, 'n_tokens_neox': 431, 'n_words': 85}