At 5:18 PM -0700 6/9/06, [EMAIL PROTECTED] wrote:
Hi,
The API for logging DC1 data is a simple Python function, log. Currently,
the application message will be written to whereever the local syslog.conf
specifies those messages should be sent (usually /var/log/messages).
import log
log.log (message, priority)
Great!
Priority is defined in any man page for syslog (either in C or Python).
Priority levels include:
LOG_EMERG system is unusable
LOG_ALERT action must be taken immediately
LOG_CRIT critical conditions
LOG_ERR error conditions
LOG_WARNING warning conditions
LOG_NOTICE normal, but significant, condition
LOG_INFO informational message
LOG_DEBUG debugging message
The default priority is LOG_INFO, so specifying the priority is optional.
Also, use these as you would in C, except you will need to specify them
as Python strings. I haven't found a way around that yet.
These are constants defined in the syslog module, so you could just
import those constants. A nicety would be to ditch the LOG_ prefix so
we could write:
import log
log.log(msgStr, log.ALERT)
but that would be a bit more trouble than just importing them "as is".
Still, it's not hard:
EMERG = syslog.LOG_EMERG
ALERT = syslog.LOG_ALERT
CRIT = syslog.LOG_CRIT
etc.
There's probably some simple way to automate this, but it's not
coming to me at the moment (the question being how to define new
variables in the module by naming them from a string).
-- Russell
_______________________________________________
LSST-data mailing list
[email protected]
http://www.lsstmail.org/mailman/listinfo/lsst-data