seancorfield/fw1 — pull request #150 by bcswartz (2012-12-10 02:17:45+00:00)
Title: Added code to track a variable (traceVar) within the trace array

Made changes to the tracing code that allows a developer to add a variable called traceVar to the rc struct (rc.traceVar= "foo") and track what happens with that variable throughout the request lifecycle. it gives developers a way to log variable states in order to debug requests that might involve several service calls or redirects.

This feature adds a Boolean variable to the request._fw1 struct called "traceVarDeclared" that starts off as false, and adds a traceVar key/value pair to the struct added to the trace array in frameworkTrace(). That traceVar key/value pair will denote if the traceVar value has been detected in the lifecycle or not, and if so whether a traceVar variable exists in the request scope and what its current value is.

When it comes time to render the trace results, the code will check the state of traceVarDeclared. If it is still false, no traceVar data will be added to the trace output (so the output table will look like it did before this feature was added). If traceVarDeclared is true, the traceVar results will be added to the output, using writeDump only if the traceVar value at that stage of the lifecycle is a complex variable.

I made the changes based on the current version of framework.cfc in the develop branch. Hopefully that is the most recent version of the codebase.

Feel free to change the wording of the traceVar messages for when the traceVar hasn't been declared yet or isn't in the request context of the particular stage.