From patchwork Mon Jan 7 23:11:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 166 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 843C4600CC for ; Tue, 8 Jan 2019 00:10:48 +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 087E4530 for ; Tue, 8 Jan 2019 00:10:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1546902648; bh=rNX/4JQBdYqjmk8vMJqf81o78lM0u93vAU04+tVxWiE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=EFHq87tgplne4TllGU7NQHZMCxpf+CQgoktUhgGLCtMSG5TLt2JO5LJlMS8ONQWBL gtnBBPCKRPiamPBqnP/ov4IOPB7nlGMTaST25iU9bxhvXzPvdxkVb6GqbUdnI7XoL4 xMmp00Ib9Oj0BNMQSNW/8GGqmvamzlyi9XXnQnlg= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Tue, 8 Jan 2019 01:11:43 +0200 Message-Id: <20190107231151.23291-4-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190107231151.23291-1-laurent.pinchart@ideasonboard.com> References: <20190107231151.23291-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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: Mon, 07 Jan 2019 23:10:48 -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 6785d371449e..c1ec55618ea3 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 << " ";