| 878 | |
| 879 | |
| 880 | void LogError(const char *logstr, ...) |
| 881 | { |
| 882 | va_list args; |
| 883 | time_t tval; |
| 884 | char *tstr; |
| 885 | |
| 886 | errorFound = TRUE; |
| 887 | // Open logfile if closed |
| 888 | if (Debug == TRUE && logfile == NULL) |
| 889 | { |
| 890 | logfile = fopen(DEU_LOG_FILE, "a"); |
| 891 | if (logfile == NULL) |
| 892 | { |
| 893 | Notify ("Could not open log file \"%s\"", DEU_LOG_FILE); |
| 894 | } |
| 895 | } |
| 896 | if (Debug == TRUE && logfile != NULL) |
| 897 | { |
| 898 | va_start( args, logstr); |
| 899 | /* if the messsage begins with ":", output the current date & time first */ |
| 900 | if (logstr[ 0] == ':') |
| 901 | { |
| 902 | time( &tval); |
| 903 | tstr = ctime( &tval); |
| 904 | tstr[ strlen( tstr) - 1] = '\0'; |
| 905 | fprintf(logfile, "%s", tstr); |
| 906 | } |
| 907 | vfprintf( logfile, logstr, args); |
| 908 | va_end( args); |
| 909 | fflush (logfile); |
| 910 | } |
| 911 | } |
| 912 | |
| 913 | /* |
| 914 | write a message in the status bar of the main frame |
no test coverage detected