<commit_before>/***************************************************************************//**
 * \file   logger.c
 *
 * \brief  logging facility for C
 * \author <NAME>
 * \date   2010-10-13
 ******************************************************************************/
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
#include <fcntl.h>
#include "logger.h"

#ifdef LOGGER_ENABLE

#define LOGGER_OUTPUTS_MAX    16                           /**< number of possible simultaneous outputs */
#define LOGGER_IDS_MAX        16                           /**< number of possible ids */

typedef struct logger_control_s {
  logger_bool_t      used;    /**< this id is used */
  logger_bool_t      enabled; /**< this id is enabled */
  logger_level_t     level;   /**< level for this id */
  logger_bool_t      color;   /**< changed colors for this id */
  logger_text_fg_t   fg;      /**< foreground color of this id */
  logger_text_bg_t   bg;      /**< background color of this id */
  logger_text_attr_t attr;    /**< attributes of this id */
  logger_bool_t      cont;    /**< previous message didn't contain a newline, thus omit prefix for next message */
} logger_control_t;

typedef struct logger_output_s {
  int            count;   /**< number of registrations for this stream */
  logger_level_t level;   /**< level for this stream */
  FILE           *stream; /**< file pointer given during registration */
} logger_output_t;

static logger_bool_t    logger_enabled;                     /**< logger is enabled */
static logger_control_t logger_control[LOGGER_IDS_MAX];     /**< control storage for possible ids */
static logger_output_t  logger_outputs[LOGGER_OUTPUTS_MAX]; /**< storage for possible output streams */

/** ************************************************************************//**
 * \brief  initialize logger
 *
 * \return     LOGGER_OK if no error occurred, error code otherwise<commit_msg>[chg] increase to 256 possible ids and outputs<commit_after>/***************************************************************************//**
 * \file   logger.c
 *
 * \brief  logging facility for C
 * \author <NAME>
 * \date   2010-10-13
 ******************************************************************************/
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
#include <fcntl.h>
#include "logger.h"

#ifdef LOGGER_ENABLE

#define LOGGER_OUTPUTS_MAX    256                          /**< number of possible simultaneous outputs */
#define LOGGER_IDS_MAX        256                          /**< number of possible ids */

typedef struct logger_control_s {
  logger_bool_t      used;    /**< this id is used */
  logger_bool_t      enabled; /**< this id is enabled */
  logger_level_t     level;   /**< level for this id */
  logger_bool_t      color;   /**< changed colors for this id */
  logger_text_fg_t   fg;      /**< foreground color of this id */
  logger_text_bg_t   bg;      /**< background color of this id */
  logger_text_attr_t attr;    /**< attributes of this id */
  logger_bool_t      cont;    /**< previous message didn't contain a newline, thus omit prefix for next message */
} logger_control_t;

typedef struct logger_output_s {
  int            count;   /**< number of registrations for this stream */
  logger_level_t level;   /**< level for this stream */
  FILE           *stream; /**< file pointer given during registration */
} logger_output_t;

static logger_bool_t    logger_enabled;                     /**< logger is enabled */
static logger_control_t logger_control[LOGGER_IDS_MAX];     /**< control storage for possible ids */
static logger_output_t  logger_outputs[LOGGER_OUTPUTS_MAX]; /**< storage for possible output streams */

/** ************************************************************************//**
 * \brief  initialize logger
 *
 * \return     LOGGER_OK if no error occurred, error code otherwise
{'fraction_non_alphanumeric': 0.20982257649781436, 'fraction_numerical': 0.007456929802005657, 'mean_word_length': 3.0861344537815127, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2039615', 'n_tokens_mistral': 1079, 'n_tokens_neox': 1023, 'n_words': 328}