Incubaid/arakoon — pull request #66 by domsj (2013-05-28 09:00:37+00:00)
Title: Optimize logging

This pull request fixes the crash_logging and implements the optimization in which strings for the crashlogger are only computed when needed.
The lazyness is implemented by the type Crash_logger.msg which is either an immediate string or a (unit -> string).
Some syntactic sugar for this has been added in the form macros.

Logger.{debug/info/...}_f section "format%s string" "bla"
->
Logger.log_ Logger.{Debug/Info/...} section (fun () -> Printf.sprintf "format%s string" "bla")

macros ending with _ also capture the variable 'section' which is expected to be defined in the environment, e.g.:

Logger.{debug/info/...}_f_ "format%s string" "bla"
->
Logger.log_ Logger.{Debug/Info/...} section (fun () -> Printf.sprintf "format%s string" "bla")

I tried to eliminate all usages of Lwt_log (except in the modules specifically dealing with logging ofcourse). Some usages are still left but these are not statements doing logging themselves; if desired I can centralize this into the logger module too.