small convenience requested by philip: file_stats_dump is now disabled by default (use debug_filter_add("FILE_STATS") to reenable)

This was SVN commit r4753.
This commit is contained in:
janwas 2007-01-07 17:35:26 +00:00
parent 95f8aa126f
commit 785694a4af
3 changed files with 14 additions and 4 deletions

View File

@ -155,7 +155,7 @@ void debug_filter_clear()
tags[i] = 0;
}
static bool filter_allows(const char* text)
bool debug_filter_allows(const char* text)
{
uint i;
for(i = 0; ; i++)
@ -187,7 +187,7 @@ void debug_printf(const char* fmt, ...)
vsnprintf(buf, MAX_CHARS-1, fmt, ap);
va_end(ap);
if(filter_allows(buf))
if(debug_filter_allows(buf))
debug_puts(buf);
}
@ -224,7 +224,7 @@ void debug_wprintf(const wchar_t* fmt, ...)
// .. paranoia: overflow is impossible
debug_assert(bytes_written <= MAX_BYTES);
if(filter_allows(mbs_buf))
if(debug_filter_allows(mbs_buf))
debug_puts(mbs_buf);
}

View File

@ -253,7 +253,7 @@ extern ErrorReaction debug_display_error(const wchar_t* description,
* we don't want to require different LOGn() macros that are enabled
* depending on "debug level", because changing that entails lengthy
* compiles and it's too coarse-grained. instead, we require all
* strings to start with "tag_string:" (exact case and no quotes;
* strings to start with "tag_string|" (exact case and no quotes;
* the alphanumeric-only <tag_string> identifies output type).
* they are then subject to filtering: only if the tag has been
* "added" via debug_filter_add is the appendant string displayed.
@ -285,6 +285,13 @@ extern void debug_filter_remove(const char* tag);
**/
extern void debug_filter_clear();
/**
* indicate if the given text would be printed.
* useful for a series of debug_printfs - avoids needing to add a tag to
* each of their format strings.
**/
extern bool debug_filter_allows(const char* text);
/**
* write to memory buffer (fast)

View File

@ -288,6 +288,9 @@ template<typename T> int percent(T num, T divisor)
void file_stats_dump()
{
if(!debug_filter_allows("FILE_STATS|"))
return;
const double KB = 1e3; const double MB = 1e6; const double ms = 1e-3;
debug_printf("--------------------------------------------------------------------------------\n");