Hi Chris, As they say, better late than never, hm.
Christopher Baines <m...@cbaines.net> writes: > Hey! > > I ran in to some problems with the <log-handler> formatter recently, it > seems it's being called with more than 3 arguments since the update to > guile-lib 0.2.8. > > Can you advise on how to approach this? This changed in commit 509ef778e1ee5d80e0aad5a25d82e6ab57d40c45 ("logging: Allow passing source properties to `log-msg'."), whose commit message contains a hint: (default-log-formatter) [source-properties]: New keyword argument, that is formatted as a source location prefix when available. Add #:allow-other-keys to signal users they should use such a signature to ensure forward compatibility. The new default-log-formatter reads as: --8<---------------cut here---------------start------------->8--- (define* (default-log-formatter lvl time str #:key source-properties proc-name #:allow-other-keys) "Default log formatting procedure. For source properties to be available, they must be manually provided to @code{log-msg} via a suitable syntax wrapper (currently left to the user to implement). @var{proc-name}, if available, is the name of the procedure the message was logged from." (let ((file-name (assoc-ref source-properties 'filename)) ;; Note: increment the source property zero-indexed line by 1, ;; to comply with the GNU Standards guidelines (info ;; '(standards) Errors'). (line (and=> (assoc-ref source-properties 'line) 1+)) (column (assoc-ref source-properties 'column))) (format #f "~a ~@[~a ~]~@[(~a) ~]~:@(~a~): ~a~%" (strftime "%F %H:%M:%S" (localtime time)) (and (or file-name line column) (format #f "~@[~a:~]~@[~a:~]~@[~a:~]" file-name line column)) proc-name lvl str))) --8<---------------cut here---------------end--------------->8--- You should be able to to use a similar signature. I think even this is valid, as the most minimal change you can do to your formatter signature: --8<---------------cut here---------------start------------->8--- ((lambda* (one two three #:key _ #:allow-other-keys) (display "that works\n")) 1 2 3) that works --8<---------------cut here---------------end--------------->8--- > I presume this isn't some internal interface I'm using accidentally? The > documentation states: > > #:formatter > > This optional parameter must be a function that takes three > arguments: the log level, the time (as from current-time), and the > log string itself. The function must return a string representing > the formatted log. It seems I forgot changing this documentation in the above mentioned commit. I'll address this. Thanks for the report! -- Thanks, Maxim