mirror of https://github.com/OpenTTD/OpenTTD
Cleanup: remove old DEBUG macro and debug function
parent
55a11710a6
commit
352dbdd570
|
@ -143,24 +143,6 @@ void debug_print(const char *dbg, const char *buf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Output a debug line.
|
|
||||||
* @note Do not call directly, use the #DEBUG macro instead.
|
|
||||||
* @param dbg Debug category.
|
|
||||||
* @param format Text string a la printf, with optional arguments.
|
|
||||||
*/
|
|
||||||
void CDECL debug(const char *dbg, const char *format, ...)
|
|
||||||
{
|
|
||||||
char buf[1024];
|
|
||||||
|
|
||||||
va_list va;
|
|
||||||
va_start(va, format);
|
|
||||||
vseprintf(buf, lastof(buf), format, va);
|
|
||||||
va_end(va);
|
|
||||||
|
|
||||||
debug_print(dbg, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set debugging levels by parsing the text in \a s.
|
* Set debugging levels by parsing the text in \a s.
|
||||||
* For setting individual levels a string like \c "net=3,grf=6" should be used.
|
* For setting individual levels a string like \c "net=3,grf=6" should be used.
|
||||||
|
|
11
src/debug.h
11
src/debug.h
|
@ -15,7 +15,7 @@
|
||||||
#include "3rdparty/fmt/format.h"
|
#include "3rdparty/fmt/format.h"
|
||||||
|
|
||||||
/* Debugging messages policy:
|
/* Debugging messages policy:
|
||||||
* These should be the severities used for direct DEBUG() calls
|
* These should be the severities used for direct Debug() calls
|
||||||
* maximum debugging level should be 10 if really deep, deep
|
* maximum debugging level should be 10 if really deep, deep
|
||||||
* debugging is needed.
|
* debugging is needed.
|
||||||
* (there is room for exceptions, but you have to have a good cause):
|
* (there is room for exceptions, but you have to have a good cause):
|
||||||
|
@ -38,13 +38,6 @@ void debug_print(const char *dbg, const char *buf);
|
||||||
*/
|
*/
|
||||||
#define Debug(name, level, format_string, ...) if ((level) == 0 || _debug_ ## name ## _level >= (level)) debug_print(#name, fmt::format(FMT_STRING(format_string), ## __VA_ARGS__).c_str())
|
#define Debug(name, level, format_string, ...) if ((level) == 0 || _debug_ ## name ## _level >= (level)) debug_print(#name, fmt::format(FMT_STRING(format_string), ## __VA_ARGS__).c_str())
|
||||||
|
|
||||||
/**
|
|
||||||
* Output a line of debugging information.
|
|
||||||
* @param name Category
|
|
||||||
* @param level Debugging level, higher levels means more detailed information.
|
|
||||||
*/
|
|
||||||
#define DEBUG(name, level, ...) if ((level) == 0 || _debug_ ## name ## _level >= (level)) debug(#name, __VA_ARGS__)
|
|
||||||
|
|
||||||
extern int _debug_driver_level;
|
extern int _debug_driver_level;
|
||||||
extern int _debug_grf_level;
|
extern int _debug_grf_level;
|
||||||
extern int _debug_map_level;
|
extern int _debug_map_level;
|
||||||
|
@ -64,8 +57,6 @@ extern int _debug_console_level;
|
||||||
extern int _debug_random_level;
|
extern int _debug_random_level;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void CDECL debug(const char *dbg, const char *format, ...) WARN_FORMAT(2, 3);
|
|
||||||
|
|
||||||
char *DumpDebugFacilityNames(char *buf, char *last);
|
char *DumpDebugFacilityNames(char *buf, char *last);
|
||||||
void SetDebugString(const char *s);
|
void SetDebugString(const char *s);
|
||||||
const char *GetDebugString();
|
const char *GetDebugString();
|
||||||
|
|
Loading…
Reference in New Issue