[Klone-users] Logging from webapp

SZÉKELYI Szabolcs cc at mail.3d.hu
Fri Jan 2 20:39:32 EST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stefano Barbato wrote:
> 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.

Great! Thanks!

- --
cc


> On 02/gen/09, at 21:55, SZÉKELYI Szabolcs wrote:
> 
> 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?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAklewdQACgkQGJRwVVqzMkN92ACfVGlI8EdlYXdoPQtinfllsoW4
SrAAn3WBGD+85GNGKLjq0NyRr+k3m4co
=qEmf
-----END PGP SIGNATURE-----




More information about the klone-users mailing list