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)
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.
log.log("test of python logging", "LOG_ALERT")
You will notice that syslog permits two other parameters, namely option and
facility. Since this is a system-wide log, I'd like to constrain us
to using the default facility of LOG_USER with no options. So these will not
be supported parameters for the API.
Also, I discovered a python module for logging that is quite detailed and
has everyway you could think of logging something. It would be overkill
for our purposes. It has a handler for sending messages to syslog,
but the complexity is too high. Not worth it. See Logger class in
Python logging module for more information.
Comments welcome.
Cheers,
Michelle
_______________________________________________
LSST-data mailing list
[email protected]
http://www.lsstmail.org/mailman/listinfo/lsst-data