2121open Lwt.Syntax
2222open Resource_pooling
2323
24- let section = Lwt_log.Section. make " os:db"
24+ let section = Logs.Src. create " os:db"
2525let ( >> = ) = Lwt. bind
2626
2727module 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
0 commit comments