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

Re: About logging / reporting




On Sun, Aug 18, 2013 at 10:59 PM, John Cowan <cowan@xxxxxxxxxxxxxxxx> wrote:
Syslog calls are designed to be interjected anywhere into an existing
body of code, so they depend on ambient authority; you don't have to
thread the identity of the syslog port through your code.


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

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);

Currying 'syslog'  is sufficient to  obtain a true
port interface :

  (syslog-open ident option facility)
  (syslog-get-port priority)
  (syslog-close)

And either  use a parameter or  Chicken / Gambit's
'with-output-to-port' :

(parameterize
  ((current-output-port (syslog-get-port priority)))
  ...)

 
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.

--
Emmanuel