Logging?

Started by
4 comments, last by Metus 21 years, 10 months ago
How deep should i go in my logging? I''ve got a MD3 Loader and I''m logging down to Mesh Level (Mesh Skins and Mesh Vertices) but how deep.. Should I keep the logging on "Failed-To-Open" Level or down on "Vertex-XYZ" Level. The Logfile becomes very huuuge... perhaps i should keep the loggin on "Engine-Initialization" Level.. Any comments, suggestions..?
Ethereal
Advertisement
only log what u need to know... I generally do major steps and log fails.
-----------------------------------------------------------"People who usualy use the word pedantic usualy are pedantic!"-me
I only log errors. Besides sending them to debug output and optionally displaying them in a message box with a stack trace.
---visit #directxdev on afternet <- not just for directx, despite the name
One advice is to rig a logger-class and a set of message types;

here''s an example set of message types:
DBG_COMMENT,
DBG_WARNING,
DBG_ERROR,
DBG_FATAL,

Then you define a set of debug-targets (some examples):
DBG_TO_FILE,
DBG_TO_SCREEN,
DBG_TO_ASSERT,
DBG_TO_NULL,

Internally, you keep a mapping-table between message type and targets (such as DBG_COMMENT messages should be routed to the DBG_TO_NULL target).

Now you log like this:

DBG::Log(DBG_COMMENT, "Hello World");

The neat thing is that different users can have different setups for the routing table; the version I give my artists have the DBG_RESOURCE_ERROR option to screen (pops up a windows dialog), because they''re focussed on getting the art-resources in, and want to know when there''s been a problem. As a programmer, I don''t want that, and instead set the target to DBG_TO_FILE (which dumps it into the log file). Ideally, you want this mapping table stored in the config file.

As for depth you go into; you want to know relevant information... If the position of individual vertices is important to you (maybe you''re comparing your input results to that of the source-file), then by all means log them. In most cases, you''re interested in:

Resources / subsystems loaded
Errors (Warnings, Errors, Fatals)
Special occurences (which changes depending on what you''re testing at the moment).

Allan




------------------------------ BOOMZAPTry our latest game, Jewels of Cleopatra
Log only the major steps. If something goes wrong, decrease the steps to the frame or even vertex level to see exactly when it happend.

Maybe you could do on-screen logging as well if you really need the deatil but don''t want huge log-files. Just like the quake console gave at the beginning of a level. All the data and settings and init calls flying across the screen.

Sander Maréchal
[Lone Wolves Production][Articles][E-mail]

<hr />
Sander Marechal<small>[Lone Wolves][Hearts for GNOME][E-mail][Forum FAQ]</small>

Thanks for all the suggestion.
I really like the suggestion __ODIN__ gave me.
I''ll rewrite the log class after the Input class
Ethereal

This topic is closed to new replies.

Advertisement