Rev 1 | Rev 11 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1 | Rev 2 | ||
---|---|---|---|
Line 645... | Line 645... | ||
645 | 645 | ||
646 | 646 | ||
647 | void Debug_Init (const wchar_t *logfile_name) |
647 | void Debug_Init (const wchar_t *logfile_name) |
648 | { |
648 | { |
649 | // helper function for debug log file initialization |
649 | // helper function for debug log file initialization |
650 | - | ||
651 | #ifndef NDEBUG |
- | |
652 | 650 | ||
653 | FILE *fp; |
651 | FILE *fp; |
654 | 652 | ||
655 | // build the log file full qualified path name |
653 | // build the log file full qualified path name |
656 | swprintf_s (logfile_pathname, WCHAR_SIZEOF (logfile_pathname), L"%s\\%s", app_path, logfile_name); |
654 | swprintf_s (logfile_pathname, WCHAR_SIZEOF (logfile_pathname), L"%s\\%s", app_path, logfile_name); |
657 | 655 | ||
658 | // open it and erase it |
656 | // open it and erase it |
659 | _wfopen_s (&fp, logfile_pathname, L"wb"); |
657 | _wfopen_s (&fp, logfile_pathname, L"wb"); |
660 | if (fp != NULL) |
658 | if (fp != NULL) |
661 | { |
659 | { |
662 | fwprintf_s (fp, L"===LOG FILE RESET===\n"); // write the log initialization string |
660 | fwprintf_s (fp, L"===LOG FILE RESET===\n"); // write the log initialization string |
663 | fclose (fp); // flush buffers and close file |
661 | fclose (fp); // flush buffers and close file |
664 | } |
662 | } |
665 | - | ||
666 | #endif |
- | |
667 | 663 | ||
668 | return; // finished |
664 | return; // finished |
669 | } |
665 | } |
670 | 666 | ||
671 | 667 | ||
672 | void Debug_Log (const wchar_t *fmt, ...) |
668 | void Debug_Log (const wchar_t *fmt, ...) |
673 | { |
669 | { |
674 | // helper function for debug logging |
670 | // helper function for debug logging |
675 | - | ||
676 | #ifndef NDEBUG |
- | |
677 | 671 | ||
678 | FILE *fp; |
672 | FILE *fp; |
679 | va_list argptr; |
673 | va_list argptr; |
680 | 674 | ||
681 | // concatenate all the arguments in one string |
675 | // concatenate all the arguments in one string |
Line 688... | Line 682... | ||
688 | if (fp != NULL) |
682 | if (fp != NULL) |
689 | { |
683 | { |
690 | fwprintf_s (fp, log_message); // write the log message |
684 | fwprintf_s (fp, log_message); // write the log message |
691 | fclose (fp); // flush buffers and close it |
685 | fclose (fp); // flush buffers and close it |
692 | } |
686 | } |
693 | - | ||
694 | #endif |
- | |
695 | 687 | ||
696 | return; // finished |
688 | return; // finished |
697 | } |
689 | } |
698 | 690 | ||
699 | 691 |