diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2012-05-28 04:39:18 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2012-05-28 04:39:18 +0000 |
commit | f278315081b24b59bf73e9613e552e3519200a71 (patch) | |
tree | cdfe0e8d00e2c3e8002284c4541429f91cb66e68 /sca-cpp/trunk/components/log/scribe-cat.cpp | |
parent | c3eb9d1e20e1f8a7a101854d6a883692cac4e8d0 (diff) |
Improve error reporting with a reason code. Improve debug and audit logging. Fix test scripts to cleanup state from previous builds and correctly report test errors.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1343138 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/components/log/scribe-cat.cpp')
-rw-r--r-- | sca-cpp/trunk/components/log/scribe-cat.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sca-cpp/trunk/components/log/scribe-cat.cpp b/sca-cpp/trunk/components/log/scribe-cat.cpp index 7f48ddb59b..fbfdaca533 100644 --- a/sca-cpp/trunk/components/log/scribe-cat.cpp +++ b/sca-cpp/trunk/components/log/scribe-cat.cpp @@ -47,7 +47,6 @@ int cat(const string& host, const string& category, const string& type) { // Write line prefix ostringstream os; - os << "[" << host << "] "; if (length(type) != 0) os << "[" << logTime() << "] [" << type << "] "; const string prefix = str(os); @@ -58,13 +57,14 @@ int cat(const string& host, const string& category, const string& type) { const char* s = fgets(buf + pl, 8192 - pl, stdin); if (s == NULL) return 0; + + // Remove trailing '\n' const size_t l = strlen(s); - if (l < 2) - return 0; - buf[pl + l - 1] = '\0'; + if (l > 0) + buf[pl + l - 1] = '\0'; // Log the line - const failable<bool> val = scribe::log(buf, category, sc); + const failable<bool> val = scribe::log(buf, host, category, sc); if (!hasContent(val)) return 1; } |