From patchwork Tue Jan 14 01:47:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 2643 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 D2DFA6070F for ; Tue, 14 Jan 2020 02:47:33 +0100 (CET) Received: from localhost.localdomain (cpc108967-cmbg20-2-0-cust420.5-4.cable.virginm.net [81.101.7.165]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 29163563; Tue, 14 Jan 2020 02:47:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1578966453; bh=PQJncj14NlsJbVD51KcHYkNvZ5o00Og62GgFlXX7u+M=; h=From:To:Cc:Subject:Date:From; b=sNfcs0IPt0O8E+Yd61wTMxrqGbCl+0g1XrgST2oVcaGc/aCzMeA6lLqpDM5Qhznq+ rS80uhnltpeif/Nfo/H2Yl3tSkI3bk7oylKv7ugPaKpzbKJlGSgamyXWOMQV8d7OyU nOSbYfjDyE28qk9cvY0b+4yF+R4WilgNEGd7+Fv0= From: Kieran Bingham To: LibCamera Devel Date: Tue, 14 Jan 2020 01:47:28 +0000 Message-Id: <20200114014728.29981-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2] 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: Tue, 14 Jan 2020 01:47:34 -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 Signed-off-by: Kieran Bingham Reviewed-by: Niklas Söderlund --- 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 f4eb8c11adc3..7d59f411f5d7 100644 --- a/src/libcamera/log.cpp +++ b/src/libcamera/log.cpp @@ -83,10 +83,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", }; @@ -196,7 +196,7 @@ void LogOutput::write(const LogMessage &msg) break; case LoggingTargetStream: case LoggingTargetFile: - str = "[" + utils::time_point_to_string(msg.timestamp()) + "]" + str = "[" + utils::time_point_to_string(msg.timestamp()) + "] " + log_severity_name(msg.severity()) + " " + msg.category().name() + " " + msg.fileInfo() + " " + msg.msg();