transforming a logger into being lazy

4 views
Skip to first unread message

Francois Berenger

unread,
Mar 22, 2013, 2:16:25 AM3/22/13
to Biocaml
Hello,

Recently, I wrote a dumb logging module for my application
(to stop using the one in Async and have one less dependency
in my application).

I'm perfectly happy with it and it is there:
https://github.com/HappyCrow/dolog

However, I tried to do one thing that I could not manage to make
compile: I think messages should be lazy and only forced if the log
level is high enough.

Can one of you suggest modifications to achieve this goal?

Ideally, I'd like not only the print statement but even
the formating of arguments to be lazy.

I saw some code in Async doing that but I'm not smart enough
to understand their code:
https://github.com/janestreet/async_extra/blob/master/lib/log.ml

Also, their logger is way smarter than what I need (ability to logrotate
and god knows what else).

Thanks a lot,
Francois.

Ashish Agarwal

unread,
Mar 22, 2013, 6:34:24 AM3/22/13
to bio...@googlegroups.com
Hey Francois, maybe you want to post this to the Beginner's List or the main OCaml List. This is a general question, and a lot more people are likely to see your message there.



--
You received this message because you are subscribed to the Google Groups "biocaml" group.
To unsubscribe from this group and stop receiving emails from it, send an email to biocaml+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



Francois Berenger

unread,
Mar 24, 2013, 8:46:34 PM3/24/13
to bio...@googlegroups.com
On 03/22/2013 07:34 PM, Ashish Agarwal wrote:
> Hey Francois, maybe you want to post this to the Beginner's List or the
> main OCaml List. This is a general question, and a lot more people are
> likely to see your message there.

I have an answer from Martin Jambon, just need to digest it.

> On Fri, Mar 22, 2013 at 2:16 AM, Francois Berenger <bere...@riken.jp
> <mailto:bere...@riken.jp>> wrote:
>
> Hello,
>
> Recently, I wrote a dumb logging module for my application
> (to stop using the one in Async and have one less dependency
> in my application).
>
> I'm perfectly happy with it and it is there:
> https://github.com/HappyCrow/__dolog
> <https://github.com/HappyCrow/dolog>
>
> However, I tried to do one thing that I could not manage to make
> compile: I think messages should be lazy and only forced if the log
> level is high enough.
>
> Can one of you suggest modifications to achieve this goal?
>
> Ideally, I'd like not only the print statement but even
> the formating of arguments to be lazy.
>
> I saw some code in Async doing that but I'm not smart enough
> to understand their code:
> https://github.com/janestreet/__async_extra/blob/master/lib/__log.ml
> <https://github.com/janestreet/async_extra/blob/master/lib/log.ml>
>
> Also, their logger is way smarter than what I need (ability to
> logrotate and god knows what else).
>
> Thanks a lot,
> Francois.
>
> --
> You received this message because you are subscribed to the Google
> Groups "biocaml" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to biocaml+unsubscribe@__googlegroups.com
> <mailto:biocaml%2Bunsu...@googlegroups.com>.
> For more options, visit https://groups.google.com/__groups/opt_out
> <https://groups.google.com/groups/opt_out>.
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "biocaml" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to biocaml+u...@googlegroups.com.

Francois Berenger

unread,
Mar 27, 2013, 1:02:25 AM3/27/13
to bio...@googlegroups.com
I think it's better now (lazy + interface file).

I think there is no simpler OCaml logger out there:
https://github.com/HappyCrow/dolog/blob/master/log.mli

Regards,
F.
Reply all
Reply to author
Forward
0 new messages