<commit_before>/*
 * myproxy_log.c
 *
 * See myproxy_log.h for documentation.
 */

#include "myproxy_common.h"	/* all needed headers included here */

/**********************************************************************
 *
 * Internal Variables
 *
 */

struct myproxy_log_context 
{
    int syslog_facility;
    char *syslog_name;
    int debug_level;
    FILE *log_stream;
};

static struct myproxy_log_context my_context = 
{
    0,
    NULL,
    0,
    NULL
};



/**********************************************************************
 *
 * Internal Functions
 *
 */

/*
 * do_log()
 *
 * Do the actual logging of the given string.
 */
static void
do_log(const char *string, int level)
{
    /*
     * We always want to use '"%s", string' when logging in case
     * string itself contains a '%s'.
     */
    if (my_context.syslog_facility != 0) 
    {
	syslog(my_context.syslog_facility|level, "%s", string);
    }
    
    if (my_context.log_stream != NULL)
    {
	fprintf(my_context.log_stream, "%s", string);
    }
	       
    return;
}<commit_msg>since we strip off newlines from syslog messages now, we need to add them back if we're logging to stderr<commit_after>/*
 * myproxy_log.c
 *
 * See myproxy_log.h for documentation.
 */

#include "myproxy_common.h"	/* all needed headers included here */

/**********************************************************************
 *
 * Internal Variables
 *
 */

struct myproxy_log_context 
{
    int syslog_facility;
    char *syslog_name;
    int debug_level;
    FILE *log_stream;
};

static struct myproxy_log_context my_context = 
{
    0,
    NULL,
    0,
    NULL
};



/**********************************************************************
 *
 * Internal Functions
 *
 */

/*
 * do_log()
 *
 * Do the actual logging of the given string.
 */
static void
do_log(const char *string, int level)
{
    /*
     * We always want to use '"%s", string' when logging in case
     * string itself contains a '%s'.
     */
    if (my_context.syslog_facility != 0) 
    {
	syslog(my_context.syslog_facility|level, "%s", string);
    }
    
    if (my_context.log_stream != NULL)
    {
	fprintf(my_context.log_stream, "%s\n", string);
    }
	       
    return;
}
{'fraction_non_alphanumeric': 0.23149819494584836, 'fraction_numerical': 0.002707581227436823, 'mean_word_length': 3.0828729281767955, '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': '3459031', 'n_tokens_mistral': 716, 'n_tokens_neox': 689, 'n_words': 179}