[Klone-users] Logging from webapp

Stefano Barbato barbato at koanlogic.com
Fri Jan 2 17:34:26 EST 2009


You can call KLone logging functions (borrowed from the libu package)  
from within web pages (*.kl1):

	dbg()
	info()
	notice()
	warn()
	err()
	crit()
	alert()
	emerg()

Any of those functions can take printf-style arguments. For example:

	warn("file not found %s", filename);

There are also some handy conditional logging macros like:

	dbg_if()
	warn_if()
	etc.

Example:
	warn_if(size > MAXSIZE, "file %s too big", filename);

KLone also heavily use macros that jump to 'err' label on error:

	crit_err_if(users > MAXUSERS, "too many users logged in, sorry");

Search for carpal.h if you want more :-)

If you need to fine tune your logging messages you can hook the whole  
log subsystem with the u_log_set_hook() function. All messages logged  
after such call (including KLone own logging messages) will be  
redirected to your own function that can handle them in any way.

bye!
s






On 02/gen/09, at 21:55, SZÉKELYI Szabolcs wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi folks,
>
> what I'd like to do is letting my webapp use the logging facilities
> provided by klone (eg. using the same method and settings), so  
> messages
> from my webapp appear in the same flow as native klone messages.
>
> Letting klone do syslogging and providing it a fake syslog interface
> (that's also accessible from the webapp) could also be a solution (so
> logging along klone, not through it). However, I don't know yet how to
> trick klone to link against the fake syslog API instead of the real  
> one.
>
> Logging independently from klone would require opening and closing the
> logging channel on every request, so can be a big performance penalty.
>
> Any idea?
>
> Cheers,
> - --
> cc
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAklef08ACgkQGJRwVVqzMkNsOwCgjeBmzm6pG2ASDUugHFiBwpP2
> ayEAn0yI9K1UI51s8dmPKia+VNyutHU8
> =t68C
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Klone-users mailing list
> Klone-users at koanlogic.com
> http://koanlogic.com/cgi-bin/mailman/listinfo/klone-users
>




More information about the Klone-users mailing list