<commit_before>
// Imports the Google Cloud client library
const Logging = require('@google-cloud/logging');

// Your Google Cloud Platform project ID
const projectId = process.env.GCLOUD_PROJECT;

// Instantiates a client
const loggingClient = Logging({
  projectId: projectId
});

// The name of the log to write to
const logName = process.env.GCLOUD_PROJECT;
// Selects the log to write to
const log = loggingClient.log(logName);


function regularEntryToStackdriverEntry (entry)
{
	// The metadata associated with the entry
	const metadata = { resource: { type: 'global' } };

	// Prepares a log entry
	const stackdriverEntry = log.entry(metadata, entry['message']);
	
	return stackdriverEntry;
}

function regularEntriesToStackdriverEntries (entries)
{
	return entries.map(regularEntryToStackdriverEntry);
}

/**
* HTTP Cloud Function.
*
* @param {Object} req Cloud Function request context.
* @param {Object} res Cloud Function response context.
*/
exports.appendToLog = function helloHttp (req, res) {
	if (req.method == 'POST')
	{
		try
		{
			var stackdriverEntries = regularEntriesToStackdriverEntries(req.body.entries);
		}
		catch (err)
		{
			res.status(400).send({ error: 'malformed input; should be on the form of { entries: [ { message: "Entry 1 message", ... }, { message: "Entry 2 message", ... }, ... ] }'});
		}
<commit_msg>Include source location & severity in post<commit_after>
// Imports the Google Cloud client library
const Logging = require('@google-cloud/logging');

// Your Google Cloud Platform project ID
const projectId = process.env.GCLOUD_PROJECT;

// Instantiates a client
const loggingClient = Logging({
  projectId: projectId
});

// The name of the log to write to
const logName = process.env.GCLOUD_PROJECT;
// Selects the log to write to
const log = loggingClient.log(logName);


function regularEntryToStackdriverEntry (entry)
{
	// The metadata associated with the entry
	const metadata = { resource: { type: 'global' }, sourceLocation: entry['sourceLocation'], severity: entry['severity'] };

	// Prepares a log entry
	const stackdriverEntry = log.entry(metadata, entry['message']);
	
	return stackdriverEntry;
}

function regularEntriesToStackdriverEntries (entries)
{
	return entries.map(regularEntryToStackdriverEntry);
}

/**
* HTTP Cloud Function.
*
* @param {Object} req Cloud Function request context.
* @param {Object} res Cloud Function response context.
*/
exports.appendToLog = function helloHttp (req, res) {
	if (req.method == 'POST')
	{
		try
		{
			var stackdriverEntries = regularEntriesToStackdriverEntries(req.body.entries);
		}
		catch (err)
		{
			res.status(400).send({ error: 'malformed input; should be on the form of { entries: [ { message: "Entry 1 message", ... }, { message: "Entry 2 message", ... }, ... ] }'});
		}

{'fraction_non_alphanumeric': 0.12235378543236455, 'fraction_numerical': 0.003588087549336204, 'mean_word_length': 4.330783938814531, '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': '5906998', 'n_tokens_mistral': 855, 'n_tokens_neox': 813, 'n_words': 261}