any logger in core?

Francois Berenger francois.berenger.working at gmail.com
Wed Nov 7 08:34:07 GMT 2012


I could create a test program.

It compiles, at least, but has the funny property of not logging anything out.

---
module Log  = Async_extra.Log

let main () =

  let logger = Log.create (Log.Level.of_string "Debug") [Log.Output.screen] in

  Log.raw   logger "%s\n" "raw log";
  Log.info  logger "%s\n" "info log";
  Log.error logger "%s\n" "error log";
  Log.debug logger "%s\n" "debug log";

  Log.close logger
;;

main()
---

Here is the oasis file for it:
---
OASISFormat: 0.3
Name:        Toto
Version:     0.1
Synopsis:    Titi
Authors:     Me
License:     LGPL-3
Plugins:     META (0.3), DevFiles (0.3)

Executable logger_test
  Path:           .
  BuildDepends:   async_extra
  BuildTools:     ocamlbuild
  CompiledObject: native
  MainIs:         logger_test.ml
---

I was thinking all logs would print right away.

Regards,
F.

On Wed, Nov 7, 2012 at 4:18 PM, Francois Berenger
<francois.berenger.working at gmail.com> wrote:
> Hello,
>
> How can I construct a value of type Async_extra.Log.Level
> and an Async_extra.Log.Output?
>
> Sorry for the stupid question but I have never used
> polymorphic variants.
>
> If you can point me to some simple explanation
> on them, I will go and read it too
> (I looked at http://caml.inria.fr/pub/docs/manual-ocaml/manual006.html
> but it does not tell me why I should use them, just how).
>
> Thanks a lot,
> F.
>
>
> On Wednesday, November 7, 2012 10:59:54 AM UTC+9, Francois Berenger wrote:
>>
>> Yes I saw it, thanks.
>>
>> I'll also take a look at the .mli file, as I was advised to do so by
>> David House.
>> I'll try to make an example program to check I can use it correctly.
>>
>> On Tue, Nov 6, 2012 at 12:12 PM, Yaron Minsky <yminsky at janestreet.com>
>> wrote:
>> > No, did you see my link?  You can read the ocamldocs:
>> >
>> >
>> > https://ocaml.janestreet.com/ocaml-core/108.07.01/doc/async_extra/Log.html
>> >
>> > On Mon, Nov 5, 2012 at 9:51 PM, Francois Berenger
>> > <francois.berenger.working at gmail.com> wrote:
>> >> Argh! I'm forced to read an mli file. ;)
>> >>
>> >> On Mon, Nov 5, 2012 at 8:15 PM, David House <dhouse at janestreet.com>
>> >> wrote:
>> >>> Judging from the mli, there should be some ocamldocs, yes.
>> >>>
>> >>> However, I recommend just looking at the mli.
>> >>>
>> >>> On Mon, Nov 5, 2012 at 6:08 AM, Francois Berenger
>> >>> <francois.berenger.working at gmail.com> wrote:
>> >>>>
>> >>>> Is there some ocamldoc for it?
>> >>>>
>> >>>> I think I managed to compile the ocamldoc for core and async, but did
>> >>>> not find anything about a Log module into it.
>> >>>>
>> >>>>
>> >>>> On Sunday, November 4, 2012 9:15:45 PM UTC+9, Yaron Minsky wrote:
>> >>>>>
>> >>>>> Don't feel too bad about knowing about it.  It's quite new.
>> >>>>>
>> >>>>> But yeah, moving to it eventually sounds right.
>> >>>>>
>> >>>>> On Sat, Nov 3, 2012 at 6:43 PM, Sean McLaughlin <sea... at gmail.com>
>> >>>>> wrote:
>> >>>>>>
>> >>>>>> No, sorry.  I didn't know about Async.Log, and I wrote my own
>> >>>>>> logger.
>> >>>>>> Switching to this one is probably a good idea in the long run for
>> >>>>>> omake-server.
>> >>>>>>
>> >>>>>> On Thu, Nov 1, 2012 at 10:14 PM, Yaron Minsky
>> >>>>>> <ymi... at janestreet.com>
>> >>>>>> wrote:
>> >>>>>> > Sean, does your omake-server use Async.Log?  That might be a good
>> >>>>>> > example.
>> >>>>>> >
>> >>>>>> > y
>> >>>>>> >
>> >>>>>> > On Thu, Nov 1, 2012 at 9:59 PM, Francois Berenger
>> >>>>>> > <francois.ber... at gmail.com> wrote:
>> >>>>>> >> Is there some example program using this logger?
>> >>>>>> >>
>> >>>>>> >>
>> >>>>>> >> On Friday, November 2, 2012 10:40:40 AM UTC+9, Francois Berenger
>> >>>>>> >> wrote:
>> >>>>>> >>>
>> >>>>>> >>> OK, I'm hooked now.
>> >>>>>> >>>
>> >>>>>> >>> I plus core in my new project.
>> >>>>>> >>>
>> >>>>>> >>> Thanks!
>> >>>>>> >>> F.
>> >>>>>> >>>
>> >>>>>> >>
>> >>>>>
>> >>>>>
>> >>>>



More information about the core mailing list