print_endline (sprintf "Logger started with level %s" (string_of_priority level))
val level_no = int_of_priority level
val mutable enabled = false
+ method level = level
+ method levelNo = level_no
method enable = self#doCritical (lazy (enabled <- true))
method disable = self#doCritical (lazy (enabled <- false))
method log (prio: priority) msg =
self#doCritical (lazy (
if enabled && (int_of_priority prio <= level_no) then
- prerr_endline (sprintf ("%s: %s") (string_of_priority prio) msg)
+ prerr_endline (sprintf ("[UWOBO] %s: %s") (string_of_priority prio) msg)
))
end
(** non thread safe, a processingLogger is usually instantied locally for each
thread *)
-class processingLogger () =
+class processingLogger =
+ let html_escape = Netencoding.Html.encode ~in_enc:`Enc_iso88591 () in
+ fun () ->
object
val mutable log_lines: string list = []
method log msg = log_lines <- msg :: log_lines
method asHtml =
sprintf
"<html><body>\n%s\n</body></html>"
- (String.concat
- "<br />\n"
- (List.map (Netencoding.Url.encode ~plus:false) (List.rev log_lines)))
+ (String.concat "<br />\n" (List.map html_escape (List.rev log_lines)))
end