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 v4 7/7] logging: Call flush-log at the end of accept-log. Date: Sun, 25 Feb 2024 09:19:13 -0500 Message-ID: <20240225141935.8420-8-maxim.cournoyer@gmail.com> References: <20240225141935.8420-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="17609"; 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 Sun Feb 25 15:20:47 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 1reFN1-0004QD-OE for guile-devel@m.gmane-mx.org; Sun, 25 Feb 2024 15:20:47 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1reFMB-0002Np-4k; Sun, 25 Feb 2024 09:19:55 -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 1reFM9-0002NU-OD for guile-devel@gnu.org; Sun, 25 Feb 2024 09:19:53 -0500 Original-Received: from mail-qv1-xf30.google.com ([2607:f8b0:4864:20::f30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1reFM8-0004WM-5a for guile-devel@gnu.org; Sun, 25 Feb 2024 09:19:53 -0500 Original-Received: by mail-qv1-xf30.google.com with SMTP id 6a1803df08f44-68f41af71ebso26123066d6.1 for ; Sun, 25 Feb 2024 06:19:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708870790; x=1709475590; 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=rN56KarbV+q1+oyziVbEa2BhFMgNmApsvPAzARVPlTo=; b=faVL/FFLjWSHd+p6kAkEj2raX4L91AUpu2UfFYIPkmlEIB5gTOvIE1hp686eGiFG8A XSYxfGAwyxm9a786jdQXA1Bnnx+7y+Ejh1IXwE/nc7HWvuESLvij3aSg0pPZv6AZdf4U dhsyb50pUGRVERoiKPFwexrj+rP15JeWw1g+qHleZkV7nhiMuWU6oWobT8Y8A47Hpu1Q OHtGsPljrHL1txx0YwO0N+YQxpFm7CY3xVclSyLKH9xjDx60MRaENNlfCbfYCi6zvOVi 6SGkAPNJ0QM8XJgkekFvLFKO8iw8sPDn89guW55YHIb1ZQg4PJOQIC6nkG4KCJ/VeHZa 6Lng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708870790; x=1709475590; 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=rN56KarbV+q1+oyziVbEa2BhFMgNmApsvPAzARVPlTo=; b=d5w65kQQDqkyBYYsWJ3SxmYJwGZOkjZFaHyYIvTCPBAKowcJdmLlkXCC5/ZFRaNPK3 8QvhdJ+iNl1PEtmjvY7GZvYBHk+++uz1WqZk4zfEAJjTfdwACVkb/n9ZBJQPKpx7+LcI NVhsWsFPnB4mCOYWhsALkI9MGLWV3LfUAuKPrcydj/fBqVPi9Ljl62bpCn3HdQXclnmV UR1qYE/7THro31YqQ1JDEpEFPv0Je0b2sFs44AEqwCYFSA6sAZxt2X9xvW9Zm3+leGoB +OMDfAHaiU8WIxCU5PmREaPOaSniW5UsYbSbBb+Y36DbFd/We7lZ5acLlqbjEUwj4hhY Jqug== X-Gm-Message-State: AOJu0Yznp4dPLBqQOGV6lnokbRoYU68TIBrYbbyS3+ePRuUNeD1FiMys BrJzFpwkto6tG5+xWaBq7ug/FZ5qx8A58b1FJAh7jeZBPZ4PMA9zVyAaz2eX X-Google-Smtp-Source: AGHT+IH65PosBS3PMJcBenoY6toVK+MJxxe9ftRj1d1xdYNCEiE3GbGrgesO/4hTBCkiBbalTIXOsQ== X-Received: by 2002:a05:6214:2588:b0:68f:6c38:c4aa with SMTP id fq8-20020a056214258800b0068f6c38c4aamr6418595qvb.35.1708870790698; Sun, 25 Feb 2024 06:19:50 -0800 (PST) Original-Received: from localhost.localdomain (dsl-141-6.b2b2c.ca. [66.158.141.6]) by smtp.gmail.com with ESMTPSA id kr2-20020a0562142b8200b0068fcaa599f6sm1780591qvb.67.2024.02.25.06.19.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 06:19:50 -0800 (PST) X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240225141935.8420-1-maxim.cournoyer@gmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::f30; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qv1-xf30.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:22329 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 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/logging/logger.scm b/src/logging/logger.scm index b75d603..eee33a5 100644 --- a/src/logging/logger.scm +++ b/src/logging/logger.scm @@ -344,7 +344,9 @@ 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} is +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} is optional; it 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 @@ -368,7 +370,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