<commit_before>/*
   Copyright 2001-2004 The Apache Software Foundation.
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
/* @version $Id$ */
#include "jsvc.h"

/* Wether debug is enabled or not */
bool log_debug_flag = false;

/* The name of the jsvc binary. */
char *log_prog = "jsvc";

/* Dump a debug message to stderr */
void log_debug(const char *fmt, ...) {
    va_list ap;

    if (log_debug_flag==false) return;
    if (fmt==NULL) return;

    va_start(ap,fmt);
    fprintf(stderr,"%s debug: ",log_prog);
    vfprintf(stderr,fmt,ap);
    fprintf(stderr,"\n");
    fflush(stderr);
    va_end(ap);
}

/* Dump an error message to stderr */
void log_error(const char *fmt, ...) {
    va_list ap;

    if (fmt==NULL) return;

    va_start(ap,fmt);
    fprintf(stderr,"%s error: ",log_prog);
    vfprintf(stderr,fmt,ap);
    fprintf(stderr,"\n");
    fflush(stderr);
    va_end(ap);
}

<commit_msg>Add date, time and pid to the printed messages.<commit_after>/*
   Copyright 2001-2004 The Apache Software Foundation.
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
/* @version $Id$ */
#include "jsvc.h"
#include <sys/types.h>
#include <unistd.h>
#include <time.h> 

/* Wether debug is enabled or not */
bool log_debug_flag = false;

/* The name of the jsvc binary. */
char *log_prog = "jsvc";

/* Dump a debug message to stderr */
void log_debug(const char *fmt, ...) {
    va_list ap;
    time_t now;
    struct tm *nowtm;
    char buff[80];

    if (log_debug_flag==false) return;
    if (fmt==NULL) return;

    now = time(NULL);
    nowtm = localtime(&now);
    strftime(buff, sizeof(buff), "%d/%m/%Y %T", nowtm);

    va_start(ap,fmt);
    fprintf(stderr,"%s %d %s debug: ", buff,  getpid(), log_prog);
    vfprintf(stderr,fmt,ap);
    fprintf(stderr,"\n");
    fflush(stderr);
    va_end(ap);
}

/* Dump an error message to stderr */
void log_error(const char *fmt, ...) {
    va_list ap;
    time_t now;
    struct tm *nowtm;
    char buff[80];

    if (fmt==NULL) return;

    now = time(NULL);
    nowtm = localtime(&now);
    strftime(buff, sizeof(buff), "%d/%m/%Y %T", nowtm);

    va_start(ap,fmt);
    fprintf(stderr,"%s %d %s error: ", buff, getpid(), log_prog);
    vfprintf(stderr,fmt,ap);
    fprintf(stderr,"\n");
    fflush(stderr);
    va_end(ap);
}


{'fraction_non_alphanumeric': 0.1272395991497115, 'fraction_numerical': 0.00850288490737929, 'mean_word_length': 3.2339331619537277, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6487691', 'n_tokens_mistral': 1100, 'n_tokens_neox': 1065, 'n_words': 366}