some example program using the logger
David House
dhouse at janestreet.com
Thu Nov 8 10:21:15 GMT 2012
For the sake of comparison, I would write this as follows. (N.b.:
untested! There are probably typos.)
open Core.Std
open Async.Std
let main () =
Log.Global.set_level (Log.Level.of_string "Debug");
Log.global.set_output Log.Output.screen;
Log.Global.raw "%s" "raw log";
Log.Global.debug "%s" "debug log";
Log.Global.info "%s" "info log";
Log.Global.error "%s" "error log";
Printf.printf "a printf\n";
shutdown 0
let () =
main ();
never_returns (Scheduler.go ())
On Thu, Nov 8, 2012 at 5:09 AM, Francois
<francois.berenger.fun at gmail.com> wrote:
> Hi,
>
> Thanks to all the feedback I got,
> I could do what I want.
> It compiles and runs properly.
>
> Regards,
> F.
> ---
> module Log = Async_extra.Log.Blocking
> module LogLevel = Async_extra.Log.Level
> module LogOutput = Async_extra.Log.Blocking.Output
>
> let main () =
>
> Log.set_level (LogLevel.of_string "Debug");
> Log.set_output LogOutput.screen;
>
> Log.raw "%s" "raw log";
> Log.debug "%s" "debug log";
> Log.info "%s" "info log";
> Log.error "%s" "error log";
>
> Printf.printf "a printf\n"
> ;;
>
> main()
> ---
>
More information about the core
mailing list