open Uwobo_common;;
(* debugging settings *)
-let debug = false;;
-let debug_level = `Notice;;
-let debug_print s = if debug then prerr_endline s;;
-Http_common.debug := false;;
-let logfile = Some "uwobo.log";; (* relative to execution dir *)
-let logfile_perm = 0o640;;
+let debug = false ;;
+let debug_level = `Notice ;;
+let debug_print s = if debug then prerr_endline s ;;
+Http_common.debug := false ;;
(* other settings *)
-let daemon_name = "UWOBO OCaml";;
-let default_port = 58080;;
-let port_env_var = "UWOBO_PORT";;
-let default_media_type = "text/html";;
-let default_encoding = "utf8";;
+let daemon_name = "UWOBO OCaml" ;;
+let default_log_file = "uwobo.log" ;; (* relative to execution dir *)
+let default_port = 58080 ;;
+let port_env_var = "UWOBO_PORT" ;;
+let default_media_type = "text/html" ;;
+let default_encoding = "utf8" ;;
+let logfile =
+ Some (try Sys.getenv "UWOBO_LOG_FILE" with Not_found -> default_log_file)
+;;
+let logfile_perm = 0o640 ;;
let port =
try
int_of_string (Sys.getenv port_env_var)
(* (1) system logger *)
let logger_outchan =
match logfile with
- | None -> stderr
+ | None ->
+ debug_print "Logging to standard error";
+ stderr
| Some f ->
+ debug_print (sprintf "Logging to file %s" f);
open_out_gen [Open_wronly; Open_append; Open_creat] logfile_perm f
in
let syslogger =