Navigation


Changeset 965:9b37f34c1b1f in freeDiameter for libfdcore/fdd.l


Ignore:
Timestamp:
Mar 13, 2013, 1:23:37 AM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Some modifications to logging code:

  • Added a FD_LOG_NOTICE level for the logger function
  • Separated the internal debug levels (NONE, INFO, ...) from the "printlevel" for the logger
  • Renamed TRACE_DEBUG_ERROR to TRACE_ERROR for symetry
  • Renamed TRACE_DEBUG_BUFFER and TRACE_DEBUG_sSA. There take now the printlevel as parameter
  • Added new TRACE_NOTICE, fd_log_notice and fd_log_error macros.
  • sorry if I forgot some changes...
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/fdd.l

    r961 r965  
    5252        yylloc->first_column = yylloc->last_column + 1;                 \
    5353        yylloc->last_column = yylloc->first_column + yyleng - 1;        \
    54         TRACE_DEBUG_ERROR(                                              \
     54        TRACE_ERROR(                                            \
    5555                "(%d:%d-%d:%d) matched rule %d, length=%d, txt='%s'\n", \
    5656                yylloc->first_line, yylloc->first_column,               \
     
    8484int globerrfct(const char *epath, int eerrno)
    8585{
    86         TRACE_DEBUG_ERROR("Failed to scan %s: %s\n", epath, strerror(eerrno));
     86        TRACE_ERROR("Failed to scan %s: %s\n", epath, strerror(eerrno));
    8787        return 1;
    8888}
     
    119119                        if (buf[yyleng-2] != '"')
    120120                        {
    121                                 TRACE_DEBUG_ERROR("Unterminated string: %s\n", yytext);
     121                                TRACE_ERROR("Unterminated string: %s\n", yytext);
    122122                                return LEX_ERROR;
    123123                        }
     
    126126                        if (current_nested_level >= MAX_NESTED_CONF_FILES)
    127127                        {
    128                                 TRACE_DEBUG_ERROR("Too many recursion levels in configuration files includes\n");
     128                                TRACE_ERROR("Too many recursion levels in configuration files includes\n");
    129129                                return LEX_ERROR;
    130130                        }
     
    135135                        if (globerror == GLOB_NOSPACE)
    136136                        {
    137                                 TRACE_DEBUG_ERROR("Not enough memory to parse include directive.\n");
     137                                TRACE_ERROR("Not enough memory to parse include directive.\n");
    138138                                return LEX_ERROR;
    139139                        }
    140140                        if (globerror == GLOB_ABORTED)
    141141                        {
    142                                 TRACE_DEBUG_ERROR("An error was encountered in include directive.\n");
     142                                TRACE_ERROR("An error was encountered in include directive.\n");
    143143                                return LEX_ERROR;
    144144                        }
     
    150150                        if (globerror)
    151151                        {
    152                                 TRACE_DEBUG_ERROR("Unexpected error in glob (%d).\n", globerror);
     152                                TRACE_ERROR("Unexpected error in glob (%d).\n", globerror);
    153153                                return LEX_ERROR;
    154154                        }
     
    166166                        if ( ! yyin )
    167167                        {
    168                                 TRACE_DEBUG_ERROR("Error in %s: %s", nested_conffiles[current_nested_level].filelist.gl_pathv[0], strerror(errno));
     168                                TRACE_ERROR("Error in %s: %s", nested_conffiles[current_nested_level].filelist.gl_pathv[0], strerror(errno));
    169169                                return LEX_ERROR;
    170170                        }
     
    206206                                if ( ! yyin )
    207207                                {
    208                                         TRACE_DEBUG_ERROR("Error in %s: %s", nested_conffiles[current_nested_level].filelist.gl_pathv[nested_conffiles[current_nested_level].current_file], strerror(errno));
     208                                        TRACE_ERROR("Error in %s: %s", nested_conffiles[current_nested_level].filelist.gl_pathv[nested_conffiles[current_nested_level].current_file], strerror(errno));
    209209                                        return LEX_ERROR;
    210210                                }
     
    234234                                if (ret != 1) {
    235235                                        /* No matching: an error occurred */
    236                                         TRACE_DEBUG_ERROR("Unable to convert the value '%s' to a valid number: %s\n", yytext, strerror(errno));
     236                                        TRACE_ERROR("Unable to convert the value '%s' to a valid number: %s\n", yytext, strerror(errno));
    237237                                        return LEX_ERROR; /* trig an error in yacc parser */
    238238                                        /* Maybe we could REJECT instead of failing here? */
     
    277277        /* Unrecognized character */
    278278<*>.                    {
    279                                 TRACE_DEBUG_ERROR("Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext);
     279                                TRACE_ERROR("Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext);
    280280                                return LEX_ERROR;
    281281                        }
Note: See TracChangeset for help on using the changeset viewer.