• Welcome to Valhalla Legends Archive.
 

Pretty Log Files

Started by Grok, August 09, 2004, 01:30 PM

Previous topic - Next topic

Grok

My diagnostic log file entries are looking pretty nice so decided to share.  Whenever I enter/exit a function, I increment +1/-1 the indention level.  All logging entries are done at the indent level parameter.

Quote
14:25:52 ----------------------------------------------
14:25:52 WIKBatchRelease.DLL loaded.
14:25:52   KfxReleaseScript::Class_Initialize() {}
14:25:52     ReleaseScript::OpenScript() {
14:25:52       CustomProperties("KeyfileServer") = 'SERVER'
14:25:52       CustomProperties("KeyfileUser") = 'SUPER'
14:25:52       CustomProperties("KeyfilePassword") = '******'
14:25:52       CustomProperties("ContainerObjId") = 'SERVER.24DM63J.0G9VG2L'
14:25:52       Connecting to Keyfile ...
14:25:52         Connected.
14:25:52       return (0)
14:25:52     }
14:25:54     ReleaseScript::ReleaseDoc() {
14:25:54       Forced error for diagnostic purposes.
14:25:54       return (-1)
14:25:54     }
14:25:54     ReleaseScript::ReleaseDoc() {
14:25:54       Forced error for diagnostic purposes.
14:25:54       return (-1)
14:25:54     }
14:25:54     ReleaseScript::ReleaseDoc() {
14:25:54       Forced error for diagnostic purposes.
14:25:54       return (-1)
14:25:54     }
14:25:54     ReleaseScript::ReleaseDoc() {
14:25:54       Forced error for diagnostic purposes.
14:25:54       return (-1)
14:25:54     }
14:25:54     ReleaseScript::ReleaseDoc() {
14:25:54       Forced error for diagnostic purposes.
14:25:54       return (-1)
14:25:54     }
14:25:54     ReleaseScript::CloseScript() {
14:25:54       return (0)
14:25:54     }
14:25:54   KfxReleaseScript::Class_Terminate() {}

In a more complex program involving nested function calls, this makes it very easy to figure out the call stack and error conditions.

iago

Very nice.  I had something very similar for my Starcraft plugin.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Banana fanna fo fanna

did you do that with AOP, or manually?