From patchwork Sun Jan 6 02:33:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 152 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 85BFB60B2E for ; Sun, 6 Jan 2019 03:32:27 +0100 (CET) Received: from avalon.bb.dnainternet.fi (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 245BF513 for ; Sun, 6 Jan 2019 03:32:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1546741947; bh=5d6i/BBznSoao+qquiwR3emq5p6mlKKhj4zQUtQJEos=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dpYM/rCEhScUm9Gahh1TW85ujyIYv27Hb3yG0HJ1rW9xdinBa/cx4w1uvgmlUFNql p4Wf0JhFDQupvZ2MkYVhRKvUdOxE6b4VpN9QFb8L2OLhvvhLP/tW4bSlnULukNkYhr UXYtNx7XaI8hGTP8JJ2GN4+qgWKtMQ2bFxO9RM9Q= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sun, 6 Jan 2019 04:33:20 +0200 Message-Id: <20190106023328.10989-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190106023328.10989-1-laurent.pinchart@ideasonboard.com> References: <20190106023328.10989-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 03/11] libcamera: log: Pad timestamp fields with zeros X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jan 2019 02:32:27 -0000 The logger prints the timestamp fields with a fixed width, but pads them with spaces instead of zeros. Fix this. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/libcamera/log.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp index 4165cbd654fc..e4d07fbbea3b 100644 --- a/src/libcamera/log.cpp +++ b/src/libcamera/log.cpp @@ -101,10 +101,12 @@ LogMessage::LogMessage(const char *fileName, unsigned int line, /* Log the timestamp, severity and file information. */ struct timespec timestamp; clock_gettime(CLOCK_MONOTONIC, ×tamp); + msgStream.fill('0'); msgStream << "[" << timestamp.tv_sec / (60 * 60) << ":" << std::setw(2) << (timestamp.tv_sec / 60) % 60 << ":" << std::setw(2) << timestamp.tv_sec % 60 << "." << std::setw(9) << timestamp.tv_nsec << "]"; + msgStream.fill(' '); msgStream << " " << log_severity_name(severity); msgStream << " " << basename(fileName) << ":" << line << " ";