Navigation


Changeset 944:6cdb2a54aaf6 in freeDiameter


Ignore:
Timestamp:
Feb 12, 2013, 7:51:10 PM (11 years ago)
Author:
Thomas Klausner <tk@giga.or.at>
Branch:
default
Phase:
public
Message:

Log config file errors using the standard logging framework instead of fprintf.

Location:
libfdcore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/fdd.l

    r740 r944  
    5252        yylloc->first_column = yylloc->last_column + 1;                 \
    5353        yylloc->last_column = yylloc->first_column + yyleng - 1;        \
    54         TRACE_DEBUG(FULL,                                               \
    55                 "(%d:%d-%d:%d) matched rule %d, length=%d, txt='%s'\n", \
     54        TRACE_DEBUG_ERROR("(%d:%d-%d:%d) matched rule %d, length=%d, txt='%s'\n",       \
    5655                yylloc->first_line, yylloc->first_column,               \
    5756                yylloc->last_line, yylloc->last_column,                 \
     
    104103                                if (ret != 1) {
    105104                                        /* No matching: an error occurred */
    106                                         fprintf(stderr, "Unable to convert the value '%s' to a valid number: %s\n", yytext, strerror(errno));
     105                                        TRACE_DEBUG_ERROR("Unable to convert the value '%s' to a valid number: %s\n", yytext, strerror(errno));
    107106                                        return LEX_ERROR; /* trig an error in yacc parser */
    108107                                        /* Maybe we could REJECT instead of failing here? */
     
    147146        /* Unrecognized character */
    148147<*>.                    {
    149                                 fprintf(stderr, "Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext);
     148                                TRACE_DEBUG_ERROR("Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext);
    150149                                return LEX_ERROR;
    151150                        }
  • libfdcore/fdd.y

    r808 r944  
    6262void yyerror (YYLTYPE *ploc, struct fd_config * conf, char const *s)
    6363{
    64         if (ploc->first_line != ploc->last_line)
    65                 fprintf(stderr, "%s:%d.%d-%d.%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, ploc->last_line, ploc->last_column, s);
    66         else if (ploc->first_column != ploc->last_column)
    67                 fprintf(stderr, "%s:%d.%d-%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, ploc->last_column, s);
    68         else
    69                 fprintf(stderr, "%s:%d.%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, s);
     64        if (ploc->first_line != ploc->last_line) {
     65                TRACE_DEBUG_ERROR("%s:%d.%d-%d.%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, ploc->last_line, ploc->last_column, s);
     66        } else if (ploc->first_column != ploc->last_column) {
     67                TRACE_DEBUG_ERROR("%s:%d.%d-%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, ploc->last_column, s);
     68        } else {
     69                TRACE_DEBUG_ERROR("%s:%d.%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, s);
     70        }
    7071}
    7172
Note: See TracChangeset for help on using the changeset viewer.