[pdal] logging
Howard Butler
hobu.inc at gmail.com
Mon Oct 17 16:35:13 EDT 2011
All,
I have committed a patch to PDAL to do provide debug logging output. We previously had the switches in place, but not the actual logging mechanism. Here is a short summary of how it works:
- StageBase has an implemented virtual log(std::ostringstream& input) (and another method that takes in a std::string and forwards it for you) that issues the logging operation
- At initialize() time, a log is opened using the "log" option of the stage. For "stdlog" (std::clog), "stdout", (std::cout), and "stderr" (std::cerr) options, these are simply initialized to be the streams for these standard outputs.
* For "log" options that were specified as a file, the log file is opened as an ostream *only* if the stage has no inputs -- i.e. it is a Reader. All other stages ask down the pipeline to getLogger(), which just forwards the pointer to the ostream.
* What should we do for MultiFilters?
* if isDebug is not true for the stage, no debug info is output for that specific stage. We may want some sort of "globalDebug" option to turn isDebug on for every stage.
I initially was going to let stages themselves worry about verbosity and isDebug, but now that I write this email, I see that's not such a good way to go. Expect the the method to change to log(std::ostringstream& input, int nVerbosity), and it will make sure to test the stage's isDebug before actually writing data to the log. This way we don't have to litter the stage(s) with isDebug tests.
Howard
More information about the pdal
mailing list