sharing programmer-to-programmer. please enjoy. pages are formatted for landscape tablet, laptop, or monitor.

yLOG, execution logging

greek, clio-chrysafenios (muse of history)

daily use in production

yLOG is a shared library used in all my debug versions for hierarchical logging and tracing. using this allows me to quickly trace a programs execution and find failure points without modifying the program itself.

all programmers are different, but 250,000+ lines of code is kinda overwhelming. i needed an answer to maintain my code base by myself given i would become unfamiliar with specific programs over time. the must keep running.

source code calls

to the right is a function within my yEXEC library that daemonizes programs without losing the logger connection. yes, i could use daemon () in the standard library, but i have a few small updates i wanted. eccentric.

the code is not important. all the lines with DEBUG_YEXEC are calls to the yLOG library for a log entry during execution.

i have specific calls for enter, exit as well as pointer, integers, strings, … they are pretty simplistic so i won’t digress.

yurg library filtering

ignore the actual macro DEBUG_YEXEC for now. it is a filtering technique added by the yurg library to keep the actual output manageable and is in a different area. i am focused only on ylog here.

output file

the highlighted section to the left comes from exactly the function shown above. all from a recent run of my metis program calling yexec_deamon.

i log to a ram-drive for speed ;) so, unless i am tracking a really rapid loop, the debug versions are not appreciably slower. the files are .ulog and appear as to the left.

formatting

all lines show a time since logging started in seconds, a sequential line number, some special coding, and then automatically indented text output from the ylog calls.

indenting

ylog_enter automatically indents and ylog_exit reverses the indent..

ascii-text ulog files are easy to search by function names to cut out key code. the execution tracing is obvious. and, yurg provides many tools for reducing volumes.

a million lines of log are easy to search if you focus on enter and exit points first, then details. i do it every day. it makes debugging and maintenance much easier for me.

finally, adding the debugging lines is just part of my coding practice. i focus where i have trouble first, the add other lines for context. its organic.

as any programmer would suspect, i produce a debug version and a clean version for each program. the clean version strips all lines containing DEBUG macros or log calls during compilation. this is part of my standard makefile.

while this requires certain coding rules to keep clean, it’s a sacrifice i gladly make. your mileage my vary and others may consider it too much.

source code is GPL3 licensed, https://github.com/heatherlyrobert/yLOG

Previous
Previous

task management with metis-okeanides (prd)

Next
Next

standard screen formatting with iapetus-progonos (prd)