From fa1909efd4b9e72db3fedbc88cf7366fd760196c Mon Sep 17 00:00:00 2001 From: malc Date: Thu, 27 Aug 2015 17:50:37 +0300 Subject: [PATCH] Logging consitency --- config.ml | 14 +++++--------- main.ml | 15 ++++++--------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/config.ml b/config.ml index 5242ce6..6ce5530 100644 --- a/config.ml +++ b/config.ml @@ -577,7 +577,7 @@ let conf = { defconf with angle = defconf.angle };; let gotouri uri = if emptystr conf.urilauncher - then print_endline uri + then dolog "%s" uri else ( let url = geturl uri in if emptystr url @@ -927,8 +927,7 @@ let unentS s = let home = try Sys.getenv "HOME" with exn -> - prerr_endline - ("Can not determine home directory location: " ^ exntos exn); + dolog "Can not determine home directory location: %S" @@ exntos exn; E.s ;; @@ -1076,8 +1075,7 @@ let config_of c attrs = | "edit-annotations-inline" -> { c with annotinline = bool_of_string v } | _ -> c with exn -> - prerr_endline ("Error processing attribute (`" ^ - k ^ "'=`" ^ v ^ "'): " ^ exntos exn); + dolog "Error processing attribute (`%S' =`%S'): %S" k v @@ exntos exn; c in let rec fold c = function @@ -1861,8 +1859,7 @@ let save leavebirdseye = close_out oc; Unix.rename tmp !confpath; with exn -> - prerr_endline - ("error while saving configuration: " ^ exntos exn) + dolog "Error while saving configuration: %S" @@ exntos exn ;; let gc fdi fdo = @@ -1935,8 +1932,7 @@ let gc fdi fdo = close_out oc; Unix.rename tmp !confpath; with exn -> - prerr_endline - ("error while saving configuration: " ^ exntos exn) + dolog "Error while saving configuration: %S" @@ exntos exn ); ;; diff --git a/main.ml b/main.ml index feda503..8caea6b 100644 --- a/main.ml +++ b/main.ml @@ -125,15 +125,13 @@ let setfontsize n = let vlog fmt = if conf.verbose - then - Printf.kprintf prerr_endline fmt - else - Printf.kprintf ignore fmt + then dolog fmt + else Printf.kprintf ignore fmt ;; let launchpath () = if emptystr conf.pathlauncher - then print_endline state.path + then dolog "%s" state.path else ( let command = Str.global_replace percentsre state.path conf.pathlauncher in try addpid @@ popen command [] @@ -144,8 +142,7 @@ let launchpath () = module G = struct let postRedisplay who = - if conf.verbose - then prerr_endline ("redisplay for " ^ who); + vlog "redisplay for [%S]" who; state.redisplay <- true; ;; end;; @@ -6358,7 +6355,7 @@ let () = let histmode = emptystr state.path && not !openlast in if not (Config.load !openlast) - then prerr_endline "failed to load configuration"; + then dolog "Failed to load configuration"; begin match !pageno with | Some pageno -> state.anchor <- (pageno, 0.0, 0.0) | None -> () @@ -6489,7 +6486,7 @@ let () = ; "GL_EXT_texture_recangle" ; "GL_NV_texture_rectangle" ] ) - then (prerr_endline "OpenGL does not suppport rectangular textures"; exit 1); + then (dolog "OpenGL does not suppport rectangular textures"; exit 1); if ( let r = GlMisc.get_string `renderer in -- 2.11.4.GIT