syslog broken on FreeBSD?
Tage Stabell-Kulo
tage at pasta.cs.uit.no
Wed Mar 14 12:56:21 EST 2001
Gabriel Ambuehl <gabriel_ambuehl-py at buz.ch> writes:
>I've been trying to write to syslog using the following
>import syslog
>syslog("TEST)
Using syslog from Python is a pain in the back, mostly because it used
to be an optional module. I wrote a drop-in replacement, in Python.
It is used as follows:
try:
import syslog
except ImportError:
import slog
syslog = slog
or
try:
from syslog import *
except ImportError:
from slog import *
You can now use syslog.openlog or openlog, respectively. That is, on
systems where syslog isn't compiled or supported by Python, your
programs will run without modification. Furthermore, you can easily
alter the module to send your messages to another machine, rather than
to /dev/log.
Believed to be fully compatible with syslog(3). It is based on a
module, not at all compatible with syslog(3), written in 1997 by Sam
Rushing.
It was my first Python program, so please be kind if you find ugly
code.
You can fetch your very own copy at
ftp://ftp.pasta.cs.uit.no/pub/users/tage/Bredband/slog.py
> Gabriel
[TaSK]
--
//// Tage Stabell-Kuloe |e-mail: Tage at ACM.org (at=@)////
///Department of Computer Science/IMR|Phone : +47-776-44032 ///
//9037 University of Tromsoe, Norway|Fax : +47-776-44580 //
/ "'oe' is '\o' in TeX" |URL:http://www.cs.uit.no/~tage/
More information about the Python-list
mailing list