From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Maxim Cournoyer Newsgroups: gmane.lisp.guile.devel Subject: [Guile-Lib PATCH v3 7/7] logging: Call flush-log at the end of accept-log. Date: Thu, 8 Feb 2024 23:50:48 -0500 Message-ID: <20240209045150.17210-8-maxim.cournoyer@gmail.com> References: <20240206034201.28494-1-maxim.cournoyer@gmail.com> <20240209045150.17210-1-maxim.cournoyer@gmail.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19848"; mail-complaints-to="usenet@ciao.gmane.io" Cc: David Pirotte , Maxim Cournoyer To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Fri Feb 09 05:53:00 2024 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rYIsm-0004y7-6v for guile-devel@m.gmane-mx.org; Fri, 09 Feb 2024 05:53:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rYIrx-0006ye-8c; Thu, 08 Feb 2024 23:52:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rYIrw-0006wp-D2 for guile-devel@gnu.org; Thu, 08 Feb 2024 23:52:08 -0500 Original-Received: from mail-qk1-x72b.google.com ([2607:f8b0:4864:20::72b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rYIru-0000Qn-Pk for guile-devel@gnu.org; Thu, 08 Feb 2024 23:52:08 -0500 Original-Received: by mail-qk1-x72b.google.com with SMTP id af79cd13be357-78405c9a152so28402285a.1 for ; Thu, 08 Feb 2024 20:52:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707454325; x=1708059125; darn=gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yHDgO+7sDhrEajjZbPnfN7diOxomSGfPTjljZUlhMCI=; b=U8OmcooLe61DqZOp9muO8/adH73b42kSV7OOoV5p3NkZmmN9VAwvQjp9qfEJC5JYSS sgVO+81Suwe9qIrkbqOGFdgyVkmOnWrzXw79990WZbWG6VBlTzMEi7GtXkd/gJuQk6eb jTazlaqw89OxIebCRzMFbe31CNck7M9CyUkhmE3e313VSlLBL3yZnX3deLp3eZvDKq97 EAgzikCyo21CEv8Zf9pF56M0Xdtyhatn6qRXkPxRf0FJnJwg335nomfHcemoyngOmf9r lqpCsoXiqs1MHz62V20FMHAcG4ueGHlYkFgRPYm6rGUvNhJOPca4KJjjnDZH3s3aAzoW QN1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707454325; x=1708059125; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yHDgO+7sDhrEajjZbPnfN7diOxomSGfPTjljZUlhMCI=; b=Xt7mHclgcvj9ZQuZGk8wS8GeY84jimkzMWTVXgRBelwdixZZDu6ZgGJCoJO0zdL9OH j7BFVNbEx2LAZHb8wFg8/tRHoGsvOwAVZ7Qu3L3Pb612l+9F7tJAEKMF+mCW/3V4/cmd Ai5d9hnobPzbzbhMRK616g4bHo8un9q8LweCSk/WMwUj9MyOV3Xdv5EDgWo/u35Onymr MeXhXdsGM8SlA9T6M8oDAGFQVFq68Q1Zq37glkKdlpdvWSvxYk7gs/saBWJb3NrACPnX FLluNaUdZM2nCaIbrJlnHxXya+0sFBhKI86Wwa+1mRA6o0YDHnrGO8lUNmJFZH6gw2ZF Xlyg== X-Gm-Message-State: AOJu0Yw0hUp6+NFGz2oycJ8xaT8kNMSrO0vwvLzcEJJ1sA50ttGvURd8 h4C73CzXfEt4k+j4+A5bj36sOAEsObXjzAXMpJvfDSbDQXgI/OTb9ptvobz7 X-Google-Smtp-Source: AGHT+IHHv67HaUeAfXkqrAgW/U/z4i+CL37t1n1lH5sMpijXjpJSRTf2NbQLff1tJBrhqc8zdxxwyA== X-Received: by 2002:a05:620a:a97:b0:785:90c9:16a5 with SMTP id v23-20020a05620a0a9700b0078590c916a5mr656159qkg.8.1707454325411; Thu, 08 Feb 2024 20:52:05 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWzxQdCxhG2iQlKIH9LqYsSviB0kHAf9FfelS0Ojl25VIelPpY5Ji9YrNpcs9cfkpeSqkBAjbJuUh1C3eT7f2UCiZWGSvDMjrZg Original-Received: from localhost.localdomain (dsl-10-135-252.b2b2c.ca. [72.10.135.252]) by smtp.gmail.com with ESMTPSA id p3-20020a05620a112300b00785a2d275f0sm426970qkk.41.2024.02.08.20.52.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 20:52:04 -0800 (PST) X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240209045150.17210-1-maxim.cournoyer@gmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::72b; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qk1-x72b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.devel:22315 Archived-At: This is to avoid long block buffering of log messages, which would causes the log messages to be delayed, which is likely to confuse users attempting to follow the logs in real time (see: https://lists.gnu.org/archive/html/guile-devel/2024-01/msg00000.html). * src/logging/logger.scm (accept-log): Call flush-log after a log is emitted. Update doc. --- (no changes since v1) src/logging/logger.scm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/logging/logger.scm b/src/logging/logger.scm index 7085d26..2384208 100644 --- a/src/logging/logger.scm +++ b/src/logging/logger.scm @@ -342,12 +342,13 @@ registered handlers.") (define-generic-with-docs accept-log "@code{accept-log handler lvl time str}. If @var{lvl} is enabled for @var{handler}, then @var{str} will be formatted and sent -to the log via the @code{emit-log} method. @var{source-properties} -can be either @code{#f} or an association list containing the file -name, line, and column source information provided to the -@code{log-msg} call. Formatting is done via the formatting function -given at @var{handler}'s creation time, or by the default if none was -given. +to the log via the @code{emit-log} method. @code{flush-port} is +called after emitting a log to ensure users tailing the source file +can see new messages in real time. @var{source-properties} can be +either @code{#f} or an association list containing the file name, +line, and column source information provided to the @code{log-msg} +call. Formatting is done via the formatting function given at +@var{handler}'s creation time, or by the default if none was given. This method should not normally need to be overridden by subclasses. This method should not normally be called by users of the logging @@ -361,7 +362,8 @@ override this behavior.") (when (level-enabled? self level) (emit-log self ((log-formatter self) level time str #:source-properties source-properties - #:proc-name proc-name)))) + #:proc-name proc-name)) + (flush-log self))) ;; This should be overridden by all log handlers to actually ;; write out a string. -- 2.41.0