[Pkg-ocaml-maint-commits] r2650 -
/trunk/projects/approx/trunk/log.ml
ecc-guest at users.alioth.debian.org
ecc-guest at users.alioth.debian.org
Sat Apr 29 00:28:51 UTC 2006
Author: ecc-guest
Date: Sat Apr 29 00:28:49 2006
New Revision: 2650
URL: http://svn.debian.org/wsvn/?sc=1&rev=2650
Log:
don't fail if daemon can't connect to syslogd
Modified:
trunk/projects/approx/trunk/log.ml
Modified: trunk/projects/approx/trunk/log.ml
URL: http://svn.debian.org/wsvn/trunk/projects/approx/trunk/log.ml?rev=2650&op=diff
==============================================================================
--- trunk/projects/approx/trunk/log.ml (original)
+++ trunk/projects/approx/trunk/log.ml Sat Apr 29 00:28:49 2006
@@ -1,14 +1,18 @@
open Printf
let printer = ref (fun _ -> prerr_endline)
-
-let use_syslog () =
- let prog = Filename.basename Sys.argv.(0) in
- let log = Syslog.openlog ~facility: `LOG_DAEMON prog in
- printer := Syslog.syslog log
let message level fmt = kprintf (fun str -> !printer level str) fmt
let error_message fmt = message `LOG_ERR fmt
let info_message fmt = message `LOG_INFO fmt
let debug_message fmt = message `LOG_DEBUG fmt
+
+let use_syslog () =
+ let prog = Filename.basename Sys.argv.(0) in
+ try
+ let log = Syslog.openlog ~facility: `LOG_DAEMON prog in
+ printer := Syslog.syslog log
+ with _ ->
+ error_message "Cannot connect to system logger";
+ printer := (fun _ -> ignore)
More information about the Pkg-ocaml-maint-commits
mailing list