DebugLog
BlitzMax Forums/BlitzMax Programming/DebugLog
| ||
Hi All, Just wondering if I should remove Debuglog statements from release code? Does it add any overhead to the compiled release code? Cheers |
| ||
It get skipped when you compile in release mode. Same with Asserts. |
| ||
I understand the assert command but a single like check like that is only so useful... is there no equivalent to:if debug ' don't compile this code if its not in debug mode? If StartValue<NextValue Assert Value<StartValue Or Value>NextValue ELSE "Value Breach" Else Assert Value>StartValue Or Value<NextValue ELSE "Value Breach" End If end if |
| ||
You can do this if you don't want any code compiled :?debug ' don't compile this code if its not in debug mode? If StartValue<NextValue Assert Value<StartValue Or Value>NextValue ELSE "Value Breach" Else Assert Value>StartValue Or Value<NextValue ELSE "Value Breach" End If ? |
| ||
Check out the Conditional Compiling section of the manual under Help/Language:Conditional compiling works a bit like an If statement, but takes the form: ?Identifier The ? must appear at the start of a new line, and Identifier should be one of the following: Name Meaning Debug True if program is being compiled in debug mode. Threaded True if program is being compiled in threaded mode. Win32 True if program is being compiled for the Windows operating system. MacOS True if program is being compiled for the MacOS operating system. Linux True if program is being compiled for the Linux operating system. X86 True if program is being compiled for the Intel CPU. PPC True if program is being compiled for the PowerPC CPU. MacOSX86 True if program is being compiled for an Intel Mac. MacOSPPC True if program is being compiled for a PowerPC Mac. BigEndian True if program is being compiled for a big endian CPU. LittleEndian True if program is being compiled for a little endian CPU. Identifier may also be preceded by Not to invert the result. |
| ||
Doh Brucey you beat me to the post |
| ||
I never leave debug stuff in there, whether you're allowed to or not. BLIde has a handy "find in files" option. Type DebugLog into the search box, click each result, then delete the line. Simples. |
| ||
I never leave debug stuff in there, whether you're allowed to or not I have to say, I'm the same. Perhaps if my apps were big enough to require some "proper" logging, I would probably use that instead. Hasn't anyone created a "Log4Max" module? :-p (No, really, I was being serious... we use Log4J and Log4CPP at work) |
| ||
I've never found myself using Debug logs. I just put a DebugStop before a point of interest and peek directly, or just Print stuff out. |
| ||
Well, I use my own logger module as well as DebugStop and printing stuff out. It entirely depends on the sort of issue you're looking into. My module if anyone wants to try it: http://muttmod.googlecode.com/files/logger.mod-1.1.0.rar |
| ||
To answer the OP, DebugLog and DebugStop are functions that do nothing in release mode. They still get called for a small overhead that might be significant in extreme circumstances. Assert on the other hand is a keyword that does not result in any code in release mode. |