[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Mldonkey-devel] RFC : logging in mldonkey
From: |
Fortin Denis |
Subject: |
Re: [Mldonkey-devel] RFC : logging in mldonkey |
Date: |
Tue, 25 May 2004 15:52:44 +0200 |
After introducing the first logging bug, i am beginning to think that it
might no be a good idea to use camlp4 everywhere.
The bug was in BTClients.check_finished :
===== Buggy =====
#source :
if (file_size file <> Int64Swarmer.downloaded swarmer) then
BLOG WARN :
"%s : Downloaded size differs after complete verification\n"
(file.file_name)
ELOG;
download_finished file
#preprocessed as :
if file_size file <> Int64Swarmer.downloaded swarmer then
begin
Printf2.lwarn "WARN : %s : Downloaded size differs after complete
verification\n" file.file_name;
download_finished file
end
-----------------
===== Fixed =====
#source :
BLOG WARN (file_size file <> Int64Swarmer.downloaded swarmer) :
"%s : Downloaded size differs after complete verification\n"
(file.file_name)
ELOG;
download_finished file
#preprocessed as :
if file_size file <> Int64Swarmer.downloaded swarmer then
Printf2.lwarn "WARN : %s : Downloaded size differs after complete
verification\n" file.file_name;
download_finished file
-----------------
As you can see in the buggy piece of code the download_finised was
called only when file size differs.
I think that the first one is valid in ocaml and was supposed to do
something right.
But for a reason that i don't understand camlp4 as decided to put a
begin end at the wrong place (download_finished shouldn't be in the
begin end).
I don't know what is wrong in this case : my macro or camlp4 (i guess it
is my macro).
This left me with some questions :
Should we keep the macro like it is and trust camlp4/my macro in doing a
good job in all files of mldonkey?
Should we dump macros and use Printf2.ldebug (and preprocess only
printf2.ml) and hope that ocaml compiler will remove tests like this
if var=false then (); ?
I don't know what to think about this.
Denis
- [Mldonkey-devel] RFC : logging in mldonkey, Fortin Denis, 2004/05/07
- Re: [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