- added support for log_level and log_file in configuration file
</key>
<key name="port">58081</key>
</key>
<key name="port">58081</key>
+
+ <key name="log_level">1</key>
+ <key name="log_file">http_getter.log</key>
</section>
</helm_registry>
</section>
</helm_registry>
open Http_getter_common
open Http_getter_misc
open Http_getter_types
open Http_getter_common
open Http_getter_misc
open Http_getter_types
-open Http_getter_debugger
(Http_getter.list_servers ()))))
outchan
(Http_getter.list_servers ()))))
outchan
-let log_failure msg = debug_print ("Request not fulfilled: " ^ msg)
+let log_failure msg = Http_getter_logger.log ("Request not fulfilled: " ^ msg)
(** given an action (i.e. a function which expects a logger and do something
* using it as a logger), perform it sending its output incrementally to the
(** given an action (i.e. a function which expects a logger and do something
* using it as a logger), perform it sending its output incrementally to the
let callback (req: Http_types.request) outchan =
try
let callback (req: Http_types.request) outchan =
try
- debug_print ("Connection from " ^ req#clientAddr);
- debug_print ("Received request: " ^ req#path);
+ Http_getter_logger.log ("Connection from " ^ req#clientAddr);
+ Http_getter_logger.log ("Received request: " ^ req#path);
(match req#path with
| "/help" -> return_help outchan
| "/getxml" ->
(match req#path with
| "/help" -> return_help outchan
| "/getxml" ->
Http_daemon.respond ~body:Http_getter_const.empty_xml outchan
| invalid_request ->
Http_daemon.respond_error ~status:(`Client_error `Bad_request) outchan);
Http_daemon.respond ~body:Http_getter_const.empty_xml outchan
| invalid_request ->
Http_daemon.respond_error ~status:(`Client_error `Bad_request) outchan);
+ Http_getter_logger.log "Done!\n"
with
| Http_types.Param_not_found attr_name ->
let msg = sprintf "Parameter '%s' is missing" attr_name in
with
| Http_types.Param_not_found attr_name ->
let msg = sprintf "Parameter '%s' is missing" attr_name in
let main () =
Helm_registry.load_from configuration_file;
let main () =
Helm_registry.load_from configuration_file;
+ Http_getter_logger.set_log_level
+ (Helm_registry.get_opt_default Helm_registry.get_int 1 "getter.log_level");
+ Http_getter_logger.set_log_file
+ (Helm_registry.get_opt Helm_registry.get_string "getter.log_file");
Http_getter_env.reload ();
print_string (Http_getter_env.env_to_string ());
flush stdout;
Http_getter_env.reload ();
print_string (Http_getter_env.env_to_string ());
flush stdout;