From ca7817922148c1e6f6856138998f7135f42f3f4f Mon Sep 17 00:00:00 2001
From: Liu-Cheng Xu <xuliuchengxlc@gmail.com>
Date: Mon, 23 Dec 2024 18:20:37 +0800
Subject: [PATCH] Update prometheus binding failure logging format (#6979)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Using `{:#?}` for the error details is a bit annoying, this change makes
a more consistent formatting style for error messages.

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: command-bot <>
Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
---
 prdoc/pr_6979.prdoc                   | 8 ++++++++
 substrate/utils/prometheus/src/lib.rs | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)
 create mode 100644 prdoc/pr_6979.prdoc

diff --git a/prdoc/pr_6979.prdoc b/prdoc/pr_6979.prdoc
new file mode 100644
index 00000000000..fae7feeec2d
--- /dev/null
+++ b/prdoc/pr_6979.prdoc
@@ -0,0 +1,8 @@
+title: Update prometheus binding failure logging format
+doc:
+- audience: Node Dev
+  description: |-
+    Using `{:#?}` for the error details is a bit annoying, this change makes a more consistent formatting style for error messages.
+crates:
+- name: substrate-prometheus-endpoint
+  bump: patch
diff --git a/substrate/utils/prometheus/src/lib.rs b/substrate/utils/prometheus/src/lib.rs
index 5edac2e6650..ae39cb4a7dd 100644
--- a/substrate/utils/prometheus/src/lib.rs
+++ b/substrate/utils/prometheus/src/lib.rs
@@ -87,7 +87,7 @@ async fn request_metrics(
 /// to serve metrics.
 pub async fn init_prometheus(prometheus_addr: SocketAddr, registry: Registry) -> Result<(), Error> {
 	let listener = tokio::net::TcpListener::bind(&prometheus_addr).await.map_err(|e| {
-		log::error!(target: "prometheus", "Error binding to '{:#?}': {:#?}", prometheus_addr, e);
+		log::error!(target: "prometheus", "Error binding to '{prometheus_addr:?}': {e:?}");
 		Error::PortInUse(prometheus_addr)
 	})?;
 
-- 
GitLab