From patchwork Thu Jan 26 17:34:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barker X-Patchwork-Id: 6413 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id DDD4E23E0E for ; Thu, 26 Jan 2012 17:34:16 +0000 (UTC) Received: from mail-bk0-f52.google.com (mail-bk0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id C3CF9A1840B for ; Thu, 26 Jan 2012 17:34:16 +0000 (UTC) Received: by bkar19 with SMTP id r19so875671bka.11 for ; Thu, 26 Jan 2012 09:34:16 -0800 (PST) Received: by 10.205.127.17 with SMTP id gy17mr1414793bkc.110.1327599254292; Thu, 26 Jan 2012 09:34:14 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.204.130.220 with SMTP id u28cs47651bks; Thu, 26 Jan 2012 09:34:14 -0800 (PST) Received: by 10.180.82.41 with SMTP id f9mr5315576wiy.7.1327599253530; Thu, 26 Jan 2012 09:34:13 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id ht2si4706612wib.44.2012.01.26.09.34.13 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 Jan 2012 09:34:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1RqTDB-0007zL-47 for ; Thu, 26 Jan 2012 17:34:13 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 0FD1AE0A5A for ; Thu, 26 Jan 2012 17:34:13 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: libmatrix X-Launchpad-Branch: ~jesse-barker/libmatrix/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 32 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~jesse-barker/libmatrix/trunk] Rev 32: Only emit the colon character if the prefix is non-empty. Message-Id: <20120126173413.17360.82459.launchpad@ackee.canonical.com> Date: Thu, 26 Jan 2012 17:34:13 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="14719"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: ca1caae246ffc74f5702a53b05bd170c8656332f ------------------------------------------------------------ revno: 32 committer: Jesse Barker branch nick: trunk timestamp: Thu 2012-01-26 09:31:27 -0800 message: Only emit the colon character if the prefix is non-empty. modified: log.cc --- lp:libmatrix https://code.launchpad.net/~jesse-barker/libmatrix/trunk You are subscribed to branch lp:libmatrix. To unsubscribe from this branch go to https://code.launchpad.net/~jesse-barker/libmatrix/trunk/+edit-subscription === modified file 'log.cc' --- log.cc 2012-01-26 16:12:35 +0000 +++ log.cc 2012-01-26 17:31:27 +0000 @@ -58,16 +58,21 @@ * Print the message lines prefixed with the supplied prefix. * If the target stream is a terminal make the prefix colored. */ - string start_color; - string end_color; - static const string colon(": "); - if (!color.empty()) + string linePrefix; + if (!prefix.empty()) { - start_color = color; - if (color[0] != 0) + static const string colon(": "); + string start_color; + string end_color; + if (!color.empty()) { - end_color = terminal_color_normal; + start_color = color; + if (color[0] != 0) + { + end_color = terminal_color_normal; + } } + linePrefix = start_color + prefix + end_color + colon; } std::string line; @@ -83,7 +88,7 @@ } else { /* Normal line, emit the prefix. */ - stream << start_color << prefix << end_color << colon << line; + stream << linePrefix << line; } /* Only emit a newline if the original message has it. */