From patchwork Wed Jan 29 12:10:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 2758 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9D627608C6 for ; Wed, 29 Jan 2020 13:10:13 +0100 (CET) Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C8DA0516; Wed, 29 Jan 2020 13:10:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1580299813; bh=Lx6jz8VcUNy6JOhO16qbUWxOx04iseechbqrPkvCQpw=; h=From:To:Cc:Subject:Date:From; b=NTkmH17speSHQRnnKVjLxAH+zbLM3Y2tlmeZa95yptprS/iYKr2jKYtBauhuUW+ZV XPrXWAR0C4BHybhZELC1crUpJ8R/lTtlQFMch/OvTPjNsAxpkGsPBqyrgtshWzwS9F OYc5/f+I8IlNhJ0ITjr2oUS5vCTNLjkek7ZgC4uw= From: Kieran Bingham To: LibCamera Devel Date: Wed, 29 Jan 2020 12:10:00 +0000 Message-Id: <20200129121000.23135-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3] libcamera: log: Expand log level names X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jan 2020 12:10:13 -0000 When the log severity names were added, there was only 4 characters reserved for their printing. When the FATAL level was added, this increased to 5, and thus both DBG and ERR can be expanded to their full spelling. This also brings the levels in line with the representation that can be used when calling logSetLevel(). Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Signed-off-by: Kieran Bingham --- v3: - Rebase to master with Trhead::currentID() section. v2: - Expand commit message - Expand spacing before the log severity name is printed. src/libcamera/log.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp index 1c82dc68fb0f..fd1b5c39a52e 100644 --- a/src/libcamera/log.cpp +++ b/src/libcamera/log.cpp @@ -84,10 +84,10 @@ static int log_severity_to_syslog(LogSeverity severity) static const char *log_severity_name(LogSeverity severity) { static const char *const names[] = { - " DBG", + "DEBUG", " INFO", " WARN", - " ERR", + "ERROR", "FATAL", }; @@ -198,7 +198,7 @@ void LogOutput::write(const LogMessage &msg) case LoggingTargetStream: case LoggingTargetFile: str = "[" + utils::time_point_to_string(msg.timestamp()) + "] [" - + std::to_string(Thread::currentId()) + "]" + + std::to_string(Thread::currentId()) + "] " + log_severity_name(msg.severity()) + " " + msg.category().name() + " " + msg.fileInfo() + " " + msg.msg();