Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: Grok on August 09, 2004, 01:30 PM

Title: Pretty Log Files
Post by: Grok on August 09, 2004, 01:30 PM
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.
Title: Re:Pretty Log Files
Post by: iago on August 09, 2004, 03:17 PM
Very nice.  I had something very similar for my Starcraft plugin.
Title: Re:Pretty Log Files
Post by: Banana fanna fo fanna on August 09, 2004, 03:59 PM
did you do that with AOP, or manually?