-
Notifications
You must be signed in to change notification settings - Fork 4
Debug Log
Or How I Learned to Stop Worrying and Love the Bug
These functions are no longer used in DCmC, and will probably be removed or updated shortly
###Overview Simple namespace debug_log handle easy error debugging
-
enum log_type{comment,warning,err,fatal_error}
define type of log report (See Reference)
Name | Version | Header | Implementation |
---|---|---|---|
Debug Log | debug_log.h | debug_log.cpp |
Note that logs report will show the version of the debug_log class (which will represent the general version of Don't Crush My Castle) and may change from class to class in development stages
###Variables
Following variables are into debug_log namespace (e.g. debug_log::version
) and can be used to modify the default behaviour of debug_log::report function
-
const string version
defines the program version(which will appear in log) -
const string log_file
defines the output log file (by default dcmc.log) -
const bool show_contact
if true show the contact info in terminal log -
const string contact_info
the info that will appear whenshow_contact==true
Following variables allow developer to override all the report options defined in each report -
const bool hide_assert
if true, reports won't asser -
const bool hide_write
if true, reports won't write on debug log file -
const bool hide_show
if true, reports won't appear on execution Following variables override the settings given by previous options -
const bool force_assert
if true, every report will assert -
const bool force_write
if true, every report will write on file -
const bool force_show
if true, every report will show on execution If, for example,force_show==true
every report will show, even ifhide_show==true
###Functions
-
void report(const string &error,log_type type,bool write,bool show,bool assert=false)
will make a report with given options (e.g.debug_log::report("fail with something",fatal_error,true,true,true)
will assert the program after showing the error in terminal and writing it in log file. -
void report(const string &error,log_type type=comment)
will make a report (with show==true), calling this is the same as callingreport(error,type,false,true,false)
, by default log_type will be comment
###Example output of debug log
V0.1::Log - Error
This is a test (asserted)
------------
Output of calling debug_log::report("This is a test",err,true,true,true);
Don't Crush My Castle Wiki is under CC License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
_______________________
/ Don't Crush My Castle \
\ is a cool name /
-----------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
DCmC Wiki 0.7.6
- [Home] (Home)
- [Getting Started] (Getting Started)
- Documentation
- Reference
- Attributions