<commit_before>#include "printspu.h"
#include "cr_mothership.h"
#include "cr_string.h"
#include "cr_error.h"
#include "cr_mem.h"

#include <stdio.h>

static void __setDefaults( void )
{
	print_spu.fp = stderr;
}

void printspuGatherConfiguration( void )
{
	CRConnection *conn;
	char response[8096];

	__setDefaults();

	// Connect to the mothership and identify ourselves.
	
	conn = crMothershipConnect( );
	if (!conn)
	{
		// defaults are fine.
		return;
	}
	crMothershipIdentifySPU( conn, print_spu.id );

	if (crMothershipSPUParam( conn, response, "log_file") )
	{
		print_spu.fp = fopen( response, "w" );
		if (print_spu.fp == NULL)
		{
			crError( "Couldn't open print SPU log file %s", response );
		}<commit_msg>Added log_path config to specify where the logs should go!<commit_after>#include "printspu.h"
#include "cr_mothership.h"
#include "cr_string.h"
#include "cr_error.h"
#include "cr_mem.h"

#include <stdio.h>

static void __setDefaults( void )
{
	print_spu.fp = stderr;
}

void printspuGatherConfiguration( void )
{
	CRConnection *conn;
	char response[8096];
	char log_path[8096];

	__setDefaults();

	// Connect to the mothership and identify ourselves.
	
	conn = crMothershipConnect( );
	if (!conn)
	{
		// defaults are fine.
		return;
	}
	crMothershipIdentifySPU( conn, print_spu.id );

	if (!crMothershipSPUParam( conn, log_path, "log_path") )
	{
		strcpy( log_path, "." );
	}

	if (crMothershipSPUParam( conn, response, "log_file") )
	{
		sprintf( log_path, "%s/%s", log_path, response );
		print_spu.fp = fopen( log_path, "w" );
		if (print_spu.fp == NULL)
		{
			crError( "Couldn't open print SPU log file %s", log_path );
		}
{'fraction_non_alphanumeric': 0.13887204366282596, 'fraction_numerical': 0.0072771376591873865, 'mean_word_length': 4.271565495207668, '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': '2856162', 'n_tokens_mistral': 687, 'n_tokens_neox': 631, 'n_words': 153}