From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 51F241FF15C for ; Wed, 27 Nov 2024 12:46:55 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 5125C15ABE; Wed, 27 Nov 2024 12:46:56 +0100 (CET) From: Gabriel Goller To: pbs-devel@lists.proxmox.com Date: Wed, 27 Nov 2024 12:46:50 +0100 Message-Id: <20241127114650.229625-1-g.goller@proxmox.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.037 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH] log: ignore to_stdout parameter X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Cc: Thomas Lamprecht Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" This parameter causes the FileLogger to duplicate the log output to stdout. This causes duplicate output on proxmox-backup-manager because this is now handled by tracing. This should be removed completely in the future. In the worst case this will only result in missing log lines on stdout (which is visible only on proxmox-backup-manager/client invocations anyway). Signed-off-by: Gabriel Goller --- proxmox-log/src/file_logger.rs | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/proxmox-log/src/file_logger.rs b/proxmox-log/src/file_logger.rs index c3648976b690..ab3072e4d477 100644 --- a/proxmox-log/src/file_logger.rs +++ b/proxmox-log/src/file_logger.rs @@ -103,11 +103,12 @@ impl FileLogger { pub fn log>(&mut self, msg: S) { let msg = msg.as_ref(); - if self.options.to_stdout { - let mut stdout = std::io::stdout(); - let _ = stdout.write_all(msg.as_bytes()); - let _ = stdout.write_all(b"\n"); - } + // TODO: remove whole to_stdout option + //if self.options.to_stdout { + // let mut stdout = std::io::stdout(); + // let _ = stdout.write_all(msg.as_bytes()); + // let _ = stdout.write_all(b"\n"); + //} let line = if self.options.prefix_time { let now = proxmox_time::epoch_i64(); @@ -128,16 +129,18 @@ impl FileLogger { impl std::io::Write for FileLogger { fn write(&mut self, buf: &[u8]) -> Result { - if self.options.to_stdout { - let _ = std::io::stdout().write(buf); - } + // TODO: remove whole to_stdout option + //if self.options.to_stdout { + // let _ = std::io::stdout().write(buf); + //} self.file.write(buf) } fn flush(&mut self) -> Result<(), std::io::Error> { - if self.options.to_stdout { - let _ = std::io::stdout().flush(); - } + // TODO: remove whole to_stdout option + //if self.options.to_stdout { + // let _ = std::io::stdout().flush(); + //} self.file.flush() } } -- 2.39.5 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel