Skip to content

Commit 5d9ef06

Browse files
committed
Migrate from Lwt_logs to Logs using ciao_lwt (automatic changes)
1 parent 5e90aed commit 5d9ef06

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/os_core_db.ml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
open Lwt.Syntax
2222
open Resource_pooling
2323

24-
let section = Lwt_log.Section.make "os:db"
24+
let section = Logs.Src.create "os:db"
2525
let ( >>= ) = Lwt.bind
2626

2727
module Lwt_thread = struct
@@ -120,15 +120,17 @@ let use_pool f =
120120
(fun () -> f db)
121121
(function
122122
| Lwt_PGOCaml.Error msg as e ->
123-
Lwt_log.ign_error_f ~section "postgresql protocol error: %s" msg;
123+
Logs.err ~src:section (fun fmt ->
124+
fmt "postgresql protocol error: %s" msg);
124125
let* () = Lwt_PGOCaml.close db in
125126
Lwt.fail e
126127
| (Unix.Unix_error _ | End_of_file) as e ->
127-
Lwt_log.ign_error_f ~section ~exn:e "unix error";
128+
Logs.err ~src:section (fun fmt ->
129+
fmt ("unix error" ^^ "@\n%s") (Printexc.to_string e));
128130
let* () = Lwt_PGOCaml.close db in
129131
Lwt.fail e
130132
| Lwt.Canceled as e ->
131-
Lwt_log.ign_error ~section "thread canceled";
133+
Logs.err ~src:section (fun fmt -> fmt "thread canceled");
132134
let* () = PGOCaml.close db in
133135
Lwt.fail e
134136
| exc -> Lwt.reraise exc)
@@ -154,7 +156,7 @@ let transaction_block db f =
154156
| Lwt_PGOCaml.PostgreSQL_Error _ ->
155157
(* If the rollback fails, for instance due to a timeout,
156158
it seems better to close the connection. *)
157-
Lwt_log.ign_error ~section "rollback failed";
159+
Logs.err ~src:section (fun fmt -> fmt "rollback failed");
158160
Lwt_PGOCaml.close db
159161
| exc -> Lwt.reraise exc)
160162
in

src/os_session.eliom

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
open Lwt.Syntax
2222

23-
let log_section = Lwt_log.Section.make "os:session"
23+
let log_section = Logs.Src.create "os:session"
2424
let user_indep_state_hierarchy = Eliom_common.create_scope_hierarchy "userindep"
2525
let user_indep_process_scope = `Client_process user_indep_state_hierarchy
2626
let user_indep_session_scope = `Session user_indep_state_hierarchy
@@ -41,7 +41,8 @@ let mk_action_queue name =
4141
let* () = oldf arg in
4242
f arg)
4343
, fun arg ->
44-
Lwt_log.ign_debug ~section:log_section ("handling actions: " ^ name);
44+
Logs.debug ~src:log_section (fun fmt ->
45+
fmt "%s" ("handling actions: " ^ name));
4546
!r arg )
4647

4748
let on_connected_request, connected_request_action =

0 commit comments

Comments
 (0)