summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/logging.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-02-07 14:25:32 +0000
committerAlan Conway <aconway@apache.org>2008-02-07 14:25:32 +0000
commit4bc30db6cb860f83d0ca685c573277c09fd63567 (patch)
tree6c32b9051f576e61f8ca2720d2264fea92866982 /qpid/cpp/src/tests/logging.cpp
parente09a702c23f274f74694d7851bc59871e700c62b (diff)
downloadqpid-python-4bc30db6cb860f83d0ca685c573277c09fd63567.tar.gz
Quote unprintable control characters in log output.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@619424 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/logging.cpp')
-rw-r--r--qpid/cpp/src/tests/logging.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/qpid/cpp/src/tests/logging.cpp b/qpid/cpp/src/tests/logging.cpp
index 984af2c3c7..4969c3d6a9 100644
--- a/qpid/cpp/src/tests/logging.cpp
+++ b/qpid/cpp/src/tests/logging.cpp
@@ -367,4 +367,24 @@ BOOST_AUTO_TEST_CASE(testLoggerConfigure) {
unlink("logging.tmp");
}
+BOOST_AUTO_TEST_CASE(testQuoteControlChars) {
+ Logger& l=Logger::instance();
+ l.clear();
+ Options opts;
+ opts.outputs.clear();
+ opts.outputs.push_back("logging.tmp");
+ opts.time=false;
+ l.configure(opts, "test");
+ char s[] = "null\0tab\tspace newline\nret\r";
+ string str(s, sizeof(s));
+ QPID_LOG(critical, str);
+ ifstream log("logging.tmp");
+ string line;
+ getline(log, line);
+ string expect="critical null^@tab^Ispace newline^Jret^M^@";
+ BOOST_CHECK_EQUAL(expect, line);
+ log.close();
+ unlink("logging.tmp");
+}
+
QPID_AUTO_TEST_SUITE_END()