[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Mldonkey-devel] RFC : logging in mldonkey
From: |
Fortin Denis |
Subject: |
[Mldonkey-devel] RFC : logging in mldonkey |
Date: |
Fri, 07 May 2004 20:31:18 +0200 |
I would like to discuss the way we are logging messages in mldonkey.
In this mail you'll find a patch adding five printf like functions to
printf2.ml, which will hopefully help us to provide more clear
informations to the end user (and so getting less useless bug reports).
I decided to write this patch mainly to maximize mldonkey performance
when the user don't want to debug mldonkey. Currently even if the user
don't want to debug some tests are checked like :
if !verbose then ...
So i wrote macros in camlp4 to remove these tests at compile time.
These macros prepend to the message its level.
The syntax i choosed is
BLOG {LEVEL} {(cond)} : "format" varargs ELOG;
See howto-log.txt to know a bit more about the developper side of this
patch (and logs-in-mldonkey.txt for the user side). In the patch
(against 2.5.21 ; patch -p1 < logging.patch)
there's an example of how to use macros applied to
CommonGlobals.find_port which is the function every plugin should use
to create its server sockets (i patched bt plugin to use it).
Here are the pros and cons for this patch :
pros :
- clearer log file for the user
- more fine grained logging
- a bit faster for the user when level > debug
cons :
- more work for devs
- compiling is longer due to preprocessing
- Since level is prepended at compile time internationalization
of levels (DEBUG,INFO,...) will be hard/impossible
What do you think of this? Should we use it or drop it (partially or
all)?
NB:
*Don't ask me to do fancy things in the macros i'm not a wizard in
camlp4
*I added a pa_log.cmo dependency to the all target in makefile, but i
think it's not the best place.
Denis
howto-log.txt
Description: Text document
logging.patch
Description: Text document
logs-in-mldonkey.txt
Description: Text document
- [Mldonkey-devel] RFC : logging in mldonkey,
Fortin Denis <=
- Re: [Mldonkey-devel] RFC : logging in mldonkey, spiral voice, 2004/05/09
- Re: [Mldonkey-devel] RFC : logging in mldonkey, spiral voice, 2004/05/09
- Re: [Mldonkey-devel] RFC : logging in mldonkey, spiral voice, 2004/05/09
- Re: [Mldonkey-devel] RFC : logging in mldonkey, spiral voice, 2004/05/11
- Re: [Mldonkey-devel] RFC : logging in mldonkey, spiral voice, 2004/05/13