Logging Subsystem



The logging system allows you to track and send reports to a log file about the execution, loading, and shutting down of any component. If DEBUGMODE=1 is set during compilation a log file will be generated while the executable is running.

NAS_LOG(a, s, ...)
Places an entry into the log file with string s and can take any number of parameters exactly like printf(). The a field can be any one of these defines:

        NAS_LOG_NORMAL - Normal logging to simply place an entry
        NAS_LOG_ERROR  - Error logging, logs the message to the log file 
                         then exits the program after calling allegro 
                         message with the string
If NAS GUI is compiled with DEBUGMODE=1 then NAS_LOG_NORMAL will have affect, otherwise it's ignored. If NAS GUI is compiled with DEBUGMODE=1 then NAS_LOG_EXIT will have affect, otherwise allegro_message will only be called and the program will exit.

NAS_SET_LOG(s)
If NAS_SET_LOG() is not called before NAS_LOG_OPEN() then the log file will be named executable_name.log, otherwise you can specify a different name with this function.

NAS_LOG_OPEN()
Opens the log file for writing, must be called before logging can begin.
Note:
init_nas() calls this for you.

NAS_LOG_EXIT()
Closes the log file after writing, must be called before exiting.
Note:
nas_exit() calls this for you.



Back to Contents