Hi Michelle,
I find it hard to see what's been accomplished here. Python already has
a syslog module, with exactly the API you specify (OK, actually the
order of the priority and the message are reversed :-)). So are you
basically suggest we rename the standard python library module syslog to
be log?
Our requirements for the log class, you will recall, are:
1. That it generate messages in a uniform format that includes date/time
and information on the location of the log call inside the application.
2. That log messages from all nodes be aggregated into a single log file.
Doesn't seem that either of these have been met.
Tim
[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)
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
_______________________________________________
LSST-data mailing list
[email protected]
http://www.lsstmail.org/mailman/listinfo/lsst-data