Skip to content

Commit 830c13c

Browse files
committed
Migrate from Lwt_logs to Logs (manual changes)
1 parent 5d9ef06 commit 830c13c

File tree

6 files changed

+17
-19
lines changed

6 files changed

+17
-19
lines changed

src/os_comet.eliom

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,10 @@ let already_send_ref =
8686

8787
let%client handle_error =
8888
ref (fun exn ->
89-
Eliom_lib.Lwt_log.ign_info_f ~exn
90-
"Exception received on Os_comet's monitor channel: ";
89+
Logs.info (fun fmt ->
90+
fmt
91+
("Exception received on Os_comet's monitor channel: " ^^ "@\n%s")
92+
(Printexc.to_string exn));
9193
restart_process ();
9294
Lwt.return_unit)
9395

@@ -96,7 +98,7 @@ let%client set_error_handler f = handle_error := f
9698
let%client handle_message = function
9799
| Error exn -> !handle_error exn
98100
| Ok Heartbeat ->
99-
Eliom_lib.Lwt_log.ign_info_f "poum";
101+
Logs.info (fun fmt -> fmt "poum");
100102
Lwt.return_unit
101103
| Ok Connection_changed ->
102104
Os_msg.msg ~level:`Err

src/os_msg.eliom

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ let%shared
5050
if ~%onload then Eliom_client.lwt_onload () else Lwt.return_unit
5151
in
5252
let msgbox = msgbox () in
53-
Eliom_lib.Lwt_log.ign_info_f "%s" ~%message;
53+
Logs.info (fun fmt -> fmt "%s" ~%message);
5454
Dom.appendChild msgbox message_dom;
5555
let* () = Js_of_ocaml_lwt.Lwt_js.sleep ~%duration in
5656
Dom.removeChild msgbox message_dom;

src/os_user_view.eliom

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ let%shared
323323
Lwt.return_unit)
324324
(fun exn ->
325325
Os_msg.msg ~level:`Err "Error while uploading the picture";
326-
Eliom_lib.Lwt_log.ign_info_f "%s" ~exn "";
326+
Logs.info (fun fmt -> fmt "%s" (Printexc.to_string exn));
327327
Lwt.return_unit))
328328
: _)]
329329
:: a)

template.distillery/.ocamlformat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
version=0.28.1
2+
parse-docstrings = false
13
break-cases = fit
24
break-collection-expressions = fit-or-vertical
35
break-fun-decl = wrap

template.distillery/PROJECT_NAME.eliom

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,19 @@ let%server () =
5353
(* Print more debugging information when <debugmode/> is in config file
5454
(DEBUG = yes in Makefile.options).
5555
Example of use:
56-
let section = Lwt_log.Section.make "%%%MODULE_NAME%%%:sectionname"
56+
let section = Logs.Src.create "%%%MODULE_NAME%%%:sectionname"
5757
...
58-
Lwt_log.ign_info ~section "This is an information";
59-
(or ign_debug, ign_warning, ign_error etc.)
58+
Logs.info ~src:section (fun fmt -> "This is an information %i " 1);
59+
(or Logs.debug, Logs.err etc.)
6060
*)
6161
let%server _ =
6262
if Eliom_config.get_debugmode ()
6363
then (
64-
ignore
64+
(* ignore
6565
[%client
66-
((* Eliom_config.debug_timings := true; *)
67-
(* Lwt_log_core.add_rule "eliom:client*" Lwt_log_js.Debug; *)
68-
(* Lwt_log_core.add_rule "os*" Lwt_log_js.Debug; *)
69-
Lwt_log_core.add_rule "%%%MODULE_NAME%%%*" Lwt_log_js.Debug
70-
(* Lwt_log_core.add_rule "*" Lwt_log_js.Debug *)
71-
: unit)];
72-
(* Lwt_log_core.add_rule "*" Lwt_log.Debug *)
73-
Lwt_log_core.add_rule "%%%MODULE_NAME%%%*" Lwt_log.Debug)
66+
(Eliom_config.debug_timings := true
67+
: unit)]; *)
68+
Logs.set_level (Some Logs.Debug))
7469

7570
(* The modules below are all the modules that needs to be explicitely
7671
linked-in. *)

template.distillery/PROJECT_NAME_mobile.eliom

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,5 +148,4 @@ let _ =
148148
debugger console, you can do so by uncommenting the following
149149
lines. *)
150150
(* let () = Eliom_config.debug_timings := true *)
151-
(* let () = Lwt_log_core.add_rule "eliom:client*" Lwt_log_js.Debug *)
152-
(* let () = Lwt_log_core.add_rule "os*" Lwt_log_js.Debug *)
151+
(* let () = Logs.set_level (Some Logs.Debug) *)

0 commit comments

Comments
 (0)