@@ -321,7 +321,9 @@ let unescape line =
321321 in
322322 loop 0 0
323323
324- let section = Lwt_log.Section. make " lambda-term(history)"
324+
325+ let src = Logs.Src. create " lambda-term.history" ~doc: " logs LTerm_history module's events"
326+ module Log = (val Logs_lwt. src_log src : Logs_lwt.LOG )
325327
326328let rec safe_lockf fn fd cmd ofs =
327329 Lwt. catch (fun () ->
@@ -331,7 +333,7 @@ let rec safe_lockf fn fd cmd ofs =
331333 | Unix. Unix_error (Unix. EINTR, _ , _ ) ->
332334 safe_lockf fn fd cmd ofs
333335 | Unix. Unix_error (error , _ , _ ) ->
334- Lwt_log. ign_warning_f ~section " failed to lock file '%s': %s" fn (Unix. error_message error);
336+ Log. warn ( fun m -> m " failed to lock file '%s': %s" fn (Unix. error_message error)) >> = fun () ->
335337 return false
336338 | exn -> Lwt. fail exn )
337339
@@ -344,7 +346,7 @@ let open_history fn =
344346 | Unix. Unix_error (Unix. ENOENT, _ , _ ) ->
345347 return None
346348 | Unix. Unix_error (Unix. EACCES, _ , _ ) ->
347- Lwt_log. ign_info_f " cannot open file '%s' in read and write mode: %s" fn (Unix. error_message Unix. EACCES );
349+ Log. info ( fun m -> m " cannot open file '%s' in read and write mode: %s" fn (Unix. error_message Unix. EACCES )) >> = fun () ->
348350 (* If the file cannot be openned in read & write mode,
349351 open it in read only mode but do not lock it. *)
350352 Lwt. catch (fun () ->
@@ -369,7 +371,7 @@ let load history ?log ?(skip_empty=true) ?(skip_dup=true) fn =
369371 func
370372 | None ->
371373 fun line msg ->
372- Lwt_log. ign_error_f ~section " File %S, at line %d: %s" fn line msg
374+ Log. info ( fun m -> m " File %S, at line %d: %s" fn line msg)
373375 in
374376 (* File opening. *)
375377 open_history fn >> = fun history_file ->
@@ -392,11 +394,12 @@ let load history ?log ?(skip_empty=true) ?(skip_dup=true) fn =
392394 if not (skip_empty && is_empty entry) && not (skip_dup && is_dup history entry) then begin
393395 add_aux history entry size;
394396 history.old_count < - history.length
395- end
397+ end ;
398+ Lwt. return ()
396399 with
397400 | Zed_string. Invalid (msg , _ )-> log num msg
398401 | Zed_utf8. Invalid (msg , _ )-> log num msg
399- );
402+ ) >> = fun () ->
400403 aux (num + 1 )
401404 in
402405 aux 1 )
0 commit comments