unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Logging in Guile
@ 2020-01-13 18:06 Zelphir Kaltstahl
  2020-01-13 18:17 ` Alex Sassmannshausen
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Zelphir Kaltstahl @ 2020-01-13 18:06 UTC (permalink / raw)
  To: guile-user

Hi Guile Users!

Is there any library for logging in Guile?

What I imagine is something, where I can log messages of various levels,
like debug, info, error and such. Currently I am using display and
simple-format for all the things, but it would be nice to be able to run
a program and give it some log level, so that only the log messages of
that level or above in importance are shown. Then I could leave all my
logging in my code and set it to debug level or, if intended to be seen
for the user, set it to info level, or if there really is an error, I
could set it to error level.

On a quick search I could not find anything.

Regards,
Zelphir




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Logging in Guile
  2020-01-13 18:06 Logging in Guile Zelphir Kaltstahl
@ 2020-01-13 18:17 ` Alex Sassmannshausen
  2020-01-14 23:07   ` Zelphir Kaltstahl
  2020-01-13 18:47 ` John Cowan
  2020-01-13 21:42 ` Roel Janssen
  2 siblings, 1 reply; 7+ messages in thread
From: Alex Sassmannshausen @ 2020-01-13 18:17 UTC (permalink / raw)
  To: guile-user

Hi Zelphir,

Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes:

> Is there any library for logging in Guile?

Guile-Lib contains a set of logging modules.

Have a search for guile-lib in guix, and then check the manual.

HTH,

Alex





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Logging in Guile
  2020-01-13 18:06 Logging in Guile Zelphir Kaltstahl
  2020-01-13 18:17 ` Alex Sassmannshausen
@ 2020-01-13 18:47 ` John Cowan
  2020-01-14 23:51   ` Zelphir Kaltstahl
  2020-01-13 21:42 ` Roel Janssen
  2 siblings, 1 reply; 7+ messages in thread
From: John Cowan @ 2020-01-13 18:47 UTC (permalink / raw)
  To: Zelphir Kaltstahl; +Cc: guile-user

I have a rough proposal now at <
https://bitbucket.org/cowan/r7rs-wg1-infra/src/default/SyslogCowan.md>.  It
depends on either being able to send TCP or UDP packets or preferably to
call the Posix API through the FFI.  It is very basic and leaves log
rotation etc. to the syslog infrastructure.

On Mon, Jan 13, 2020 at 1:10 PM Zelphir Kaltstahl <
zelphirkaltstahl@posteo.de> wrote:

> Hi Guile Users!
>
> Is there any library for logging in Guile?
>
> What I imagine is something, where I can log messages of various levels,
> like debug, info, error and such. Currently I am using display and
> simple-format for all the things, but it would be nice to be able to run
> a program and give it some log level, so that only the log messages of
> that level or above in importance are shown. Then I could leave all my
> logging in my code and set it to debug level or, if intended to be seen
> for the user, set it to info level, or if there really is an error, I
> could set it to error level.
>
> On a quick search I could not find anything.
>
> Regards,
> Zelphir
>
>
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Logging in Guile
  2020-01-13 18:06 Logging in Guile Zelphir Kaltstahl
  2020-01-13 18:17 ` Alex Sassmannshausen
  2020-01-13 18:47 ` John Cowan
@ 2020-01-13 21:42 ` Roel Janssen
  2020-01-14 23:53   ` Zelphir Kaltstahl
  2 siblings, 1 reply; 7+ messages in thread
From: Roel Janssen @ 2020-01-13 21:42 UTC (permalink / raw)
  To: Zelphir Kaltstahl, guile-user

On Mon, 2020-01-13 at 19:06 +0100, Zelphir Kaltstahl wrote:
> Hi Guile Users!
> 
> Is there any library for logging in Guile?
> 
> What I imagine is something, where I can log messages of various levels,
> like debug, info, error and such. Currently I am using display and
> simple-format for all the things, but it would be nice to be able to run
> a program and give it some log level, so that only the log messages of
> that level or above in importance are shown. Then I could leave all my
> logging in my code and set it to debug level or, if intended to be seen
> for the user, set it to info level, or if there really is an error, I
> could set it to error level.
> 
> On a quick search I could not find anything.
> 
> Regards,
> Zelphir

I'm using a rather simple module that distinguishes errors from warnings and
debug:
https://github.com/UMCUGenetics/sparqling-genomics/blob/master/web/logger.scm

You could implement your own log levels easily..

So you can use it like this:
(log-error "the-calling-function" "A ~a ~a ~a" "format" "like" "format")
(log-debug "the-calling-function" "Similar to ~a" 'log-error)
(log-warning "the-calling-function" "Similar to ~a" 'log-debug)

Then there are three functions that return a port to write to:
(default-error-port) (default-warning-port) (default-debug-port)

When (null? port) => #t, no message is written.

See:
https://github.com/UMCUGenetics/sparqling-genomics/blob/dc5fea515c30aa26ff60b77911438689473d125b/web/ldap/authenticate.scm.in#L148

Kind regards,
Roel Janssen





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Logging in Guile
  2020-01-13 18:17 ` Alex Sassmannshausen
@ 2020-01-14 23:07   ` Zelphir Kaltstahl
  0 siblings, 0 replies; 7+ messages in thread
From: Zelphir Kaltstahl @ 2020-01-14 23:07 UTC (permalink / raw)
  To: guile-user

Hi Alex!

Thanks for the hint, I forgot about checking whether there is something
in guile-lib.

I will have a look.

Regards,
Zelphir

On 1/13/20 7:17 PM, Alex Sassmannshausen wrote:
> Hi Zelphir,
>
> Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes:
>
>> Is there any library for logging in Guile?
> Guile-Lib contains a set of logging modules.
>
> Have a search for guile-lib in guix, and then check the manual.
>
> HTH,
>
> Alex
>
>
>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Logging in Guile
  2020-01-13 18:47 ` John Cowan
@ 2020-01-14 23:51   ` Zelphir Kaltstahl
  0 siblings, 0 replies; 7+ messages in thread
From: Zelphir Kaltstahl @ 2020-01-14 23:51 UTC (permalink / raw)
  To: John Cowan; +Cc: guile-user

Thanks, I will also take a look at that!

On 1/13/20 7:47 PM, John Cowan wrote:
> I have a rough proposal now at
> <https://bitbucket.org/cowan/r7rs-wg1-infra/src/default/SyslogCowan.md>. 
> It depends on either being able to send TCP or UDP packets or
> preferably to call the Posix API through the FFI.  It is very basic
> and leaves log rotation etc. to the syslog infrastructure.
>
> On Mon, Jan 13, 2020 at 1:10 PM Zelphir Kaltstahl
> <zelphirkaltstahl@posteo.de <mailto:zelphirkaltstahl@posteo.de>> wrote:
>
>     Hi Guile Users!
>
>     Is there any library for logging in Guile?
>
>     What I imagine is something, where I can log messages of various
>     levels,
>     like debug, info, error and such. Currently I am using display and
>     simple-format for all the things, but it would be nice to be able
>     to run
>     a program and give it some log level, so that only the log messages of
>     that level or above in importance are shown. Then I could leave all my
>     logging in my code and set it to debug level or, if intended to be
>     seen
>     for the user, set it to info level, or if there really is an error, I
>     could set it to error level.
>
>     On a quick search I could not find anything.
>
>     Regards,
>     Zelphir
>
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Logging in Guile
  2020-01-13 21:42 ` Roel Janssen
@ 2020-01-14 23:53   ` Zelphir Kaltstahl
  0 siblings, 0 replies; 7+ messages in thread
From: Zelphir Kaltstahl @ 2020-01-14 23:53 UTC (permalink / raw)
  To: Roel Janssen, guile-user

Hi Roel,

A simple short code is always tempting, thanks. I will check it out!

Regards,
Zelphir

On 1/13/20 10:42 PM, Roel Janssen wrote:
> On Mon, 2020-01-13 at 19:06 +0100, Zelphir Kaltstahl wrote:
>> Hi Guile Users!
>>
>> Is there any library for logging in Guile?
>>
>> What I imagine is something, where I can log messages of various levels,
>> like debug, info, error and such. Currently I am using display and
>> simple-format for all the things, but it would be nice to be able to run
>> a program and give it some log level, so that only the log messages of
>> that level or above in importance are shown. Then I could leave all my
>> logging in my code and set it to debug level or, if intended to be seen
>> for the user, set it to info level, or if there really is an error, I
>> could set it to error level.
>>
>> On a quick search I could not find anything.
>>
>> Regards,
>> Zelphir
> I'm using a rather simple module that distinguishes errors from warnings and
> debug:
> https://github.com/UMCUGenetics/sparqling-genomics/blob/master/web/logger.scm
>
> You could implement your own log levels easily..
>
> So you can use it like this:
> (log-error "the-calling-function" "A ~a ~a ~a" "format" "like" "format")
> (log-debug "the-calling-function" "Similar to ~a" 'log-error)
> (log-warning "the-calling-function" "Similar to ~a" 'log-debug)
>
> Then there are three functions that return a port to write to:
> (default-error-port) (default-warning-port) (default-debug-port)
>
> When (null? port) => #t, no message is written.
>
> See:
> https://github.com/UMCUGenetics/sparqling-genomics/blob/dc5fea515c30aa26ff60b77911438689473d125b/web/ldap/authenticate.scm.in#L148
>
> Kind regards,
> Roel Janssen
>
>



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-01-14 23:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-13 18:06 Logging in Guile Zelphir Kaltstahl
2020-01-13 18:17 ` Alex Sassmannshausen
2020-01-14 23:07   ` Zelphir Kaltstahl
2020-01-13 18:47 ` John Cowan
2020-01-14 23:51   ` Zelphir Kaltstahl
2020-01-13 21:42 ` Roel Janssen
2020-01-14 23:53   ` Zelphir Kaltstahl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).