Selective printf utility?
Posted: Tue Jul 08, 2008 6:53 am
I printf to stdio from many tasks to display status info about how my application is running. However I find that with many tasks doing this, the info sent to stdout can get very confusing. It would be nice to be able to dynmically control what gets sent to stdout. Is there a utility (perhaps built with vsnprintf?) that allows me to 1) specify an output string and format, and then specify 2) a mask register (memory location, or OS flag?) and 3) a bit position in that regester to monitor. If the bit is set, the statement prints, otherwise it's ignored. Then you could set the bits in the mask (say via the web interface or a simple command processor) to control what status info is printed to stdout at any given time.
Something like:
void SelectivePrintf( int * MaskLocation, int TriggerBitPositionInMask, const char * restrict format, ...);
This mask/bit-field approach to printf would be sort of like select() or OS_Flags that trigger output on things of interest specified during runtime.
It's hard to believe something like this doesn't exist already...Just trying to avoid reinventing the wheel...
Thanks
Something like:
void SelectivePrintf( int * MaskLocation, int TriggerBitPositionInMask, const char * restrict format, ...);
This mask/bit-field approach to printf would be sort of like select() or OS_Flags that trigger output on things of interest specified during runtime.
It's hard to believe something like this doesn't exist already...Just trying to avoid reinventing the wheel...
Thanks