<commit_before>/**
 * @file libARSAL/ARSAL_Print.h
 * @brief This file contains headers about debug print abstraction layer
 * @date 06/01/2012
 * @author <EMAIL>
 */
#ifndef _ARSAL_PRINT_H_
#define _ARSAL_PRINT_H_
#include <time.h>

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

/**
 * @brief Output level
 */
typedef enum
{
    ARSAL_PRINT_ERROR,    /**< The error level, print on release and debug mode */
    ARSAL_PRINT_WARNING,  /**< The error level, print on release and debug mode */
    ARSAL_PRINT_DEBUG,    /**< The error level, print on debug mode only */
    ARSAL_PRINT_MAX,      /**< The maximum of enum, do not use !*/
} eARSAL_PRINT_LEVEL;

/**
 * @brief print a specific output (i.e. "[ERR] TAG | 14:30:24 | main:10 - My debug log")
 */
#if defined(DEBUG)
#define ARSAL_PRINT(level, tag, format, ...)                            \
    do                                                                  \
    {                                                                   \
        char __nowTimeStr [9];                                          \
        time_t __nowTimeT = time (NULL);                                \
        strftime (__nowTimeStr, 9, "%H:%M:%S", localtime (&__nowTimeT)); \
        ARSAL_PrintRaw(level, tag, "%s | %s:%d - " format, __nowTimeStr, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
    } while (0)
#else
#define ARSAL_PRINT(level, tag, format, ...)                            \
    do                                                                  \
    {                                                                   \
        if (ARSAL_PRINT_DEBUG > level)                                  \
        {                                                               \
            char __nowTimeStr [9];                                      \
            time_t __nowTimeT = time (NULL);                            \
            strftime (__nowTimeStr, 9, "%H:%M:%S", localtime (&__nowTimeT)); \
            ARSAL_PrintRaw(level, tag, "%s | %s:%d - " format, __nowTimeStr, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
        }                                                               \
    } while (0)
#endif

/**
 * @brief Convert a formatted output.
 *
 * @param level The level of output format
 * @param format output format
 * @retval On success, sal_print() returns the number of characters printed. Otherwise, it returns a negative value.
 */
int ARSAL_PrintRaw(eARSAL_PRINT_LEVEL level, const char *tag, const char *format, ...);

#endif // _ARSAL_PRINT_H_
<commit_msg>Added automatic newline at end of print<commit_after>/**
 * @file libARSAL/ARSAL_Print.h
 * @brief This file contains headers about debug print abstraction layer
 * @date 06/01/2012
 * @author fre<EMAIL>
 */
#ifndef _ARSAL_PRINT_H_
#define _ARSAL_PRINT_H_
#include <time.h>
#include <string.h>

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

/**
 * @brief Output level
 */
typedef enum
{
    ARSAL_PRINT_ERROR,    /**< The error level, print on release and debug mode */
    ARSAL_PRINT_WARNING,  /**< The error level, print on release and debug mode */
    ARSAL_PRINT_DEBUG,    /**< The error level, print on debug mode only */
    ARSAL_PRINT_MAX,      /**< The maximum of enum, do not use !*/
} eARSAL_PRINT_LEVEL;

/**
 * @brief print a specific output (i.e. "[ERR] TAG | 14:30:24 | main:10 - My debug log")
 */
#if defined(DEBUG)
#define ARSAL_PRINT(level, tag, format, ...)                            \
    do                                                                  \
    {                                                                   \
        char __nowTimeStr [9];                                          \
        time_t __nowTimeT = time (NULL);                                \
        strftime (__nowTimeStr, 9, "%H:%M:%S", localtime (&__nowTimeT)); \
        if (format[strlen (format)-1] != '\n')                          \
        {                                                               \
            ARSAL_PrintRaw(level, tag, "%s | %s:%d - " format "\n", __nowTimeStr, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
        }                                                               \
        else                                                            \
        {                                                               \
            ARSAL_PrintRaw(level, tag, "%s | %s:%d - " format, __nowTimeStr, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
        }                                                               \
    } while (0)
#else
#define ARSAL_PRINT(level, tag, format, ...)                            \
    do                                                                  \
    {                                                                   \
        if (ARSAL_PRINT_DEBUG > level)                                  \
        {                                                               \
            char __nowTimeStr [9];                                      \
            time_t __nowTimeT = time (NULL);                            \
            strftime (__nowTimeStr, 9, "%H:%M:%S", localtime (&__nowTimeT)); \
            if (format[strlen (format)-1] != '\n')                      \
            {                                                           \
                ARSAL_PrintRaw(level, tag, "%s | %s:%d - " format "\n", __nowTimeStr, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
            }                                                           \
            else                                                        \
            {                                                           \
                ARSAL_PrintRaw(level, tag, "%s | %s:%d - " format, __nowTimeStr, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
            }                                                           \
        }                                                               \
    } while (0)
#endif

/**
 * @brief Convert a formatted output.
 *
 * @param level The level of output format
 * @param format output format
 * @retval On success, sal_print() returns the number of characters printed. Otherwise, it returns a negative value.
 */
int ARSAL_PrintRaw(eARSAL_PRINT_LEVEL level, const char *tag, const char *format, ...);

#endif // _ARSAL_PRINT_H_

{'fraction_non_alphanumeric': 0.10100366417078221, 'fraction_numerical': 0.007328341564441612, 'mean_word_length': 1.0304010349288486, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 66, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2622658', 'n_tokens_mistral': 1585, 'n_tokens_neox': 1507, 'n_words': 422}