[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About logging / reporting

Emmanuel Medernach scripsit:

> I don't  think you have  to thread it  through all your code, we have
> modules don't we ?

Yes, that was an irrelevance I shouldn't have brought up.

> The  syslog interface  is very  similar to  a port interface  (in
> accordance  with  "Everything is  a file"'s Unix philosophy):
>   void openlog(const char *ident, int option, int facility);
>   void syslog(int priority, const char *format, ...);
>   void closelog(void);

But you'll notice that openlog() does not return anything recognizable
as a port, nor does syslog() accept anything like a port (unlike, say,
fprintf).  Really, what openlog() does is to override certain parameters
(in the Scheme sense) that syslog() examines; in turn, closelog()
restores the defaults.  The names "open" and "close" are very misleading.

> Currying 'syslog'  is sufficient to  obtain a true port interface :
>   (syslog-open ident option facility)
>   (syslog-get-port priority)
>   (syslog-close)

Yes, I suppose that will work.  But I wouldn't like to see it a
requirement of how to do syslog in Scheme, simply because of making this
API less flexible.

> We digress,  but for  the sake of  WG2, I  am sure being able to
> create  and handle custom ports like with  Chicken or  Racket's
> 'make-input-port'  is a good thing to have.

I've been thinking about that, but I have not been able to come up with a
sufficiently universal and yet usable SPI (service-provider interface) for
such ports.  We should move that part of the discussion to scheme-reports
or the WG2 list.

May the hair on your toes never fall out!       John Cowan
        --Thorin Oakenshield (to Bilbo)         cowan@xxxxxxxx