From patchwork Fri Jan 27 22:01:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barker X-Patchwork-Id: 6426 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 2F574249C5 for ; Fri, 27 Jan 2012 22:01:15 +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 13140A181C0 for ; Fri, 27 Jan 2012 22:01:15 +0000 (UTC) Received: by bkar19 with SMTP id r19so2384099bka.11 for ; Fri, 27 Jan 2012 14:01:14 -0800 (PST) Received: by 10.205.120.17 with SMTP id fw17mr3850111bkc.74.1327701674749; Fri, 27 Jan 2012 14:01: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 u28cs86284bks; Fri, 27 Jan 2012 14:01:14 -0800 (PST) Received: by 10.180.86.198 with SMTP id r6mr11812473wiz.2.1327701672915; Fri, 27 Jan 2012 14:01:12 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id o19si7502908weq.18.2012.01.27.14.01.12 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 27 Jan 2012 14:01:12 -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 1Rqtr6-00025Q-Ki for ; Fri, 27 Jan 2012 22:01:12 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 8A4FBE0825 for ; Fri, 27 Jan 2012 22:01:12 +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: 35 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~jesse-barker/libmatrix/trunk] Rev 35: Make appname a required parameter to Log::init and make it private as nothing public needs direct... Message-Id: <20120127220112.30014.64360.launchpad@ackee.canonical.com> Date: Fri, 27 Jan 2012 22:01:12 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="14727"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 81d8dfd8a400edd872037bb7d1c9ff4655d79717 ------------------------------------------------------------ revno: 35 committer: Jesse Barker branch nick: trunk timestamp: Fri 2012-01-27 13:40:46 -0800 message: Make appname a required parameter to Log::init and make it private as nothing public needs direct access modified: log.cc log.h --- 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-27 11:55:16 +0000 +++ log.cc 2012-01-27 21:40:46 +0000 @@ -24,7 +24,7 @@ using std::string; const string Log::continuation_prefix("\x10"); -string Log::appname; +string Log::appname_; bool Log::do_debug_(false); #ifndef ANDROID @@ -146,7 +146,7 @@ { va_list ap; va_start(ap, fmt); - __android_log_vprint(ANDROID_LOG_INFO, appname.c_str(), fmt, ap); + __android_log_vprint(ANDROID_LOG_INFO, appname_.c_str(), fmt, ap); va_end(ap); } @@ -157,7 +157,7 @@ return; va_list ap; va_start(ap, fmt); - __android_log_vprint(ANDROID_LOG_DEBUG, appname.c_str(), fmt, ap); + __android_log_vprint(ANDROID_LOG_DEBUG, appname_.c_str(), fmt, ap); va_end(ap); } @@ -166,7 +166,7 @@ { va_list ap; va_start(ap, fmt); - __android_log_vprint(ANDROID_LOG_ERROR, appname.c_str(), fmt, ap); + __android_log_vprint(ANDROID_LOG_ERROR, appname_.c_str(), fmt, ap); va_end(ap); } === modified file 'log.h' --- log.h 2012-01-26 19:41:29 +0000 +++ log.h 2012-01-27 21:40:46 +0000 @@ -18,7 +18,11 @@ class Log { public: - static void init(bool do_debug = false) { do_debug_ = do_debug; } + static void init(const std::string& appname, bool do_debug = false) + { + appname_ = appname; + do_debug_ = do_debug; + } // Emit an informational message static void info(const char *fmt, ...); // Emit a debugging message @@ -31,10 +35,11 @@ // message is a continuation of a previous log message to be put on the // same line. static const std::string continuation_prefix; +private: // A constant for identifying the log messages as originating from a // particular application. - static std::string appname; -private: + static std::string appname_; + // Indicates whether debug level messages should generate any output static bool do_debug_; };