Okay... I puzzled over the assertion macro posted above, and the replacement text of ";" for the #ifndef side doesn't seem to work under Lite-C pure mode. I've written some logging related macros that use a work around for the #ifndef side:

EDITTED: I think it best to add a reminder that logging is on, so I added some addtional code to show that logging is on and when the log file is closed.
Code:

#define LOGGING

#ifdef LOGGING
#define START_LOGGER(n) printf("Logging is on.");FILE* LOG_HANDLE = fopen( n, "w"); if (LOG_HANDLE == NULL) error("Couldn't open log file");
#define LOG(log_msg) fprintf( LOG_HANDLE, "%0.2d:%0.2d:%0.2d - %s\n", (int)sys_hours, (int)sys_minutes, (int)sys_seconds, (char*)#log_msg );
#define CLOSE_LOGGER if ( LOG_HANDLE != NULL) fclose(LOG_HANDLE);printf("Log closed.");
#else
#define COMMENT //
#define START_LOGGER(n) COMMENT
#define LOG(log_msg) COMMENT
#define CLOSE_LOGGER COMMENT
#endif

...
START_LOGGER("test.log")
...
LOG( "start_panel" )
...
CLOSE_LOGGER




Last edited by 3Dski; 11/19/07 20:09.