Skip to content

Commit

Permalink
Add logDebug
Browse files Browse the repository at this point in the history
  • Loading branch information
capehill committed Sep 23, 2019
1 parent 6a8ce75 commit 92b8608
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
14 changes: 13 additions & 1 deletion logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <stdarg.h>

static BOOL paused = FALSE;
static BOOL verbose = FALSE;

static void logLineImpl(const char * fmt, va_list ap)
{
Expand All @@ -17,7 +18,6 @@ static void logLineImpl(const char * fmt, va_list ap)
if (len >= (int)sizeof(buffer)) {
IExec->DebugPrintF("*** Line truncated: %d bytes buffer needed ***\n", len);
}

}

void logLine(const char * fmt, ...)
Expand All @@ -42,6 +42,18 @@ void logAlways(const char * fmt, ...)
va_end(ap);
}

void logDebug(const char * fmt, ...)
{
if (verbose) {
va_list ap;
va_start(ap, fmt);

logLineImpl(fmt, ap);

va_end(ap);
}
}

void pause_log(void)
{
if (!paused) {
Expand Down
1 change: 1 addition & 0 deletions logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

void logLine(const char * fmt, ...) __attribute__ ((format (printf, 1, 2)));
void logAlways(const char * fmt, ...) __attribute__ ((format (printf, 1, 2)));
void logDebug(const char * fmt, ...) __attribute__ ((format (printf, 1, 2)));

void pause_log(void);
void resume_log(void);
Expand Down

0 comments on commit 92b8608

Please sign in to comment.