From: David Robbins <David.Robbins@…>
Date: Tue, 20 Sep 2005 16:28:47 -1000
To: Joshua Hoblitt <jhoblitt@…>
Subject: RE: [ps-ipp-dev] pslib api delta report for 2005-09-19
Josh,
Sounds good. I think a good portion of what was supposed to be 'cleaned
up' has been done. If it's not too much trouble, my suggestion on the
distribution of these reports would be upon request/demand. Meaning, if
you guys have things you'd like to see done, feel free to send one.
Otherwise, I would be happy requesting a copy when needed on our side.
This document is most useful before and after each new SDRS release so
that would be a good fallback schedule.
On another note, it appears that we have had many different people
working on psTrace throughout, but apparently Robert Lupton was the
original author. The way that the function (psTrace) currently operates
seems somewhat different than the SDRS. That is, there is essentially
an additional argument for "formatting" the output. The SDRS has the
function prototype listed as-
void psTrace(const char *facil, int level, const char *format, ...);
Currently, it seems to function more like,
void psTrace(const char *facil, int level, const char *indent, const
char *format, ...);
Where indent is usually " " and is multiplied by the level. i.e., if
indent=1 space and the level=3, the output is indented 3 spaces. Or for
indent=2, level=3, 6 spaces, and so on...
Consequently, I wanted to see whether the indenting is something that
should be removed or is a desired component of this function. We're
kind of assuming that the current state is incorrect. Please advise.
-Dave
I don't understand the claim that the API now looks like:
psTrace(const char *facil, int level, const char *indent, const char *format, ...);
when the current code clearly still looks like:
psTrace(const char *facil, int level, const char *format, ...);
It seems there *is* some inconsistency in the SDRS on the issue of amount of
space to indent. The original design specified that each line would be indented
by a number of spaces equal to the trace level. When we unified the trace and
log message syntax, we also defined the trace message format to follow that of
the log messages, which just specifies 4 spaces for each message.
The multi-layer indent was the reason for the code in psTraceV
which had originally been implemented with an fprintf, but was commented out and
replaced with:
fprintf(traceFP, "%s", format);
which was printing the format statement (ie "my message: %s %d %s") 'level' times.
Bottom line: let's keep the per-level indent (based on the value of 'level').
we can easily comment out those three lines if we decide we prefer the fixed
indent. The API should continue to look like:
psTrace(const char *facil, int level, const char *format, ...);
finally, there is nothing in the SDRS that restricts the numerical level to <
level and printing it as a character. This clearly breaks down if the value is
out of the range 0-9. But, why not simply place the switch block which sets
clevel in the if statement where the level is printed and use a %d rather than a
%c for levels which are not supposed to be printed as characters?