Routino SVN Repository Browser

Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino

ViewVC logotype

Annotation of /trunk/src/logging.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1166 - (hide annotations) (download) (as text)
Tue Nov 20 16:12:08 2012 UTC (12 years, 4 months ago) by amb
File MIME type: text/x-chdr
File size: 2601 byte(s)
Replace all assert statements with a custom error message that explains the
cause and suggests a solution.

1 amb 520 /***************************************
2     Header file for logging function prototypes
3    
4     Part of the Routino routing software.
5     ******************/ /******************
6 amb 982 This file Copyright 2008-2012 Andrew M. Bishop
7 amb 520
8     This program is free software: you can redistribute it and/or modify
9     it under the terms of the GNU Affero General Public License as published by
10     the Free Software Foundation, either version 3 of the License, or
11     (at your option) any later version.
12    
13     This program is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16     GNU Affero General Public License for more details.
17    
18     You should have received a copy of the GNU Affero General Public License
19     along with this program. If not, see <http://www.gnu.org/licenses/>.
20     ***************************************/
21    
22    
23     #ifndef LOGGING_H
24     #define LOGGING_H /*+ To stop multiple inclusions. +*/
25    
26     #include <stdio.h>
27 amb 982 #include <sys/time.h>
28 amb 520
29    
30     /* Variables */
31    
32     extern int option_loggable;
33 amb 982 extern int option_logtime;
34 amb 520
35    
36 amb 804 /* Runtime progress logging functions in logging.c */
37 amb 520
38 amb 521 #ifdef __GNUC__
39    
40     void printf_first(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
41     void printf_middle(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
42     void printf_last(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
43    
44     void fprintf_first(FILE *file,const char *format, ...) __attribute__ ((format (printf, 2, 3)));
45     void fprintf_middle(FILE *file,const char *format, ...) __attribute__ ((format (printf, 2, 3)));
46     void fprintf_last(FILE *file,const char *format, ...) __attribute__ ((format (printf, 2, 3)));
47    
48     #else
49    
50 amb 520 void printf_first(const char *format, ...);
51     void printf_middle(const char *format, ...);
52     void printf_last(const char *format, ...);
53    
54     void fprintf_first(FILE *file,const char *format, ...);
55     void fprintf_middle(FILE *file,const char *format, ...);
56     void fprintf_last(FILE *file,const char *format, ...);
57    
58 amb 521 #endif
59 amb 520
60 amb 982 void fprintf_elapsed_time(FILE *file,struct timeval *start);
61 amb 521
62 amb 804 /* Parsing/processing error logging functions in logging.c */
63    
64     void open_errorlog(const char *filename,int append);
65     void close_errorlog(void);
66    
67     #ifdef __GNUC__
68    
69     void logerror(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
70    
71     #else
72    
73     void logerror(const char *format, ...);
74    
75     #endif
76    
77    
78 amb 1166 /* Runtime fatal error assertion */
79    
80     #define logassert(xx,yy) do{ if(!(xx)) _logassert(yy,__FILE__,__LINE__); } while(0);
81    
82     void _logassert(const char *message,const char *file,int line);
83    
84    
85 amb 520 #endif /* LOGGING_H */