Logger: Annotate logPrint with format attribute
This allows the compiler to check for mismatches in the format string and the passed parameters.
This commit is contained in:
parent
0da4127114
commit
c3dd8d8a47
|
@ -415,7 +415,7 @@ void Logger::closeSyslog() {
|
|||
(void) closelog();
|
||||
}
|
||||
|
||||
void Logger::logPrint(bool hex, const char * const filepath, const int line, const int level, const char *fstring, ...) {
|
||||
void Logger::logPrint(bool hex, const char *filepath, int line, int level, const char *fstring, ...) {
|
||||
if (level > mEffectiveLevel) return;
|
||||
if (level < PANIC || level > DEBUG9)
|
||||
Panic("Invalid logger level %d", level);
|
||||
|
|
|
@ -174,7 +174,12 @@ private:
|
|||
void closeDatabase();
|
||||
|
||||
public:
|
||||
void logPrint(bool hex, const char * const filepath, const int line, const int level, const char *fstring, ...);
|
||||
void logPrint(bool hex,
|
||||
const char *filepath,
|
||||
int line,
|
||||
int level,
|
||||
const char *fstring,
|
||||
...) __attribute__((format(printf, 6, 7)));
|
||||
};
|
||||
|
||||
void logInit(const char *name, const Logger::Options &options=Logger::Options());
|
||||
|
|
Loading…
Reference in New Issue