diff options
author | Chris Wilson <chris+github@qwirx.com> | 2010-02-10 19:01:12 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2010-02-10 19:01:12 +0000 |
commit | 32506e95005d396f91557e4a730ca0ee8e2c3102 (patch) | |
tree | adf918be1d281073c969259d47c4e4e5072ba68d /lib/common/Logging.cpp | |
parent | 4c4cc95eb12403298d93404f225ac04fec16586b (diff) |
Log more detailed info about backup comparison failures, for debugging.
Enable -V option in bbackupquery, and document that -q, -v, -V and
-W<level> are allowed in the command-line help.
Diffstat (limited to 'lib/common/Logging.cpp')
-rw-r--r-- | lib/common/Logging.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/common/Logging.cpp b/lib/common/Logging.cpp index 681e1352..296443ea 100644 --- a/lib/common/Logging.cpp +++ b/lib/common/Logging.cpp @@ -495,3 +495,24 @@ bool FileLogger::Log(Log::Level Level, const std::string& rFile, Logging::Add(this); return true; } + +std::string PrintEscapedBinaryData(const std::string& rInput) +{ + std::ostringstream output; + + for (size_t i = 0; i < rInput.length(); i++) + { + if (isprint(rInput[i])) + { + output << rInput[i]; + } + else + { + output << "\\x" << std::hex << std::setw(2) << + std::setfill('0') << (int) rInput[i] << + std::dec; + } + } + + return output.str(); +} |