/* 
    Spectrum Analyzer
    (C) 2007 Jason Hunt
    GPL

    file: debug.cpp
*/

#include <windows.h>
#include <stdio.h>
#include "debug.h"


/* add a line to the debug file */
void add_debug(char *str1, char *str2)
{
#ifdef debug_mode

    FILE *f = fopen("log.txt", "at");

    if (!f) return;

    // get system time
    SYSTEMTIME t;
    GetLocalTime(&t);

    // add line to log file
    fprintf(f, "[%d/%d/%d-%d:%02d:%02d.%03d] %s %s\n", t.wMonth, t.wDay, t.wYear, 
                                                       t.wHour, t.wMinute, t.wSecond, t.wMilliseconds,
                                                       str1, str2);
    fclose(f);
#endif
}
/* end of debug */


/* add a line to the debug file */
void reset_debug(void)
{
#ifdef debug_mode

    FILE *f = fopen("log.txt", "wt");

    if (!f) return;
    
    fclose(f);

#endif
}
/* end of debug */


