New logging function for LDM

Stéphane Graber <stgraber-GeWIH/[email protected]> Wed, 13 Oct 2010 11:43:04 -0400
Newsgroups gmane.linux.terminal-server.devel
Message-ID <1286984584.10316.5.camel@castiana>
Hello,

As I was cleaning up much of the new LDM code, I noticed we actually log
a lot of information but had only two categories, info and error.

In order to improve the situation, I removed the two old functions
(loginfo and logerr) and replaced them by a single "log_entry" function.

This function works as follow:
log_entry("component",<level>,"message");

Where "component" can be something like "ldm", "ssh", "rdesktop", ...
"level" is one of the following SYSLOG log levels:

LOG_EMERG   = 0     => unused
LOG_ALERT   = 1     => unused
LOG_CRIT    = 2     => die()
LOG_ERR     = 3     => Errors
LOG_WARNING = 4     => Warnings
LOG_NOTICE  = 5     => Notices
LOG_INFO    = 6     => Information
LOG_DEBUG   = 7     => Debug information

Current code uses the numeric value instead of the constant in most
calls.

"message" is the text you want to see added to the log, it can be
formated.

I converted all the current code to use that function and started a
build in my PPA. I'll run that in production here and depending on the
usefulness of the output, I'll adapt the level for each log entry.

Next step will be to add another environment variable to set the log
level when want to see in syslog/logfile.
It'll probably be something like LDM_LOGLEVEL containing a numeric value
from 0 to 7.

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb

_____________________________________________________________________
Ltsp-developer mailing list.   To un-subscribe, or change prefs, goto:
      https://lists.sourceforge.net/lists/listinfo/ltsp-developer
For additional LTSP help,   try #ltsp channel on irc.freenode.net
signature.asc (application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEABECAAYFAky104YACgkQjxyfqkjBhuxJuACdGO8iOQQS3tUwELNZ9v1997I0
20kAn1flQuZIB2NMWxwaJlUO59rZ7nsn
=NcqF
-----END PGP SIGNATURE-----