Commit caa04042481d83e1c005b43a14ec60a77e82c97a

Authored by Cédric RICARD
1 parent 257d59c2

Logger server port is now really configurable

Showing 1 changed file with 12 additions and 9 deletions   Show diff stats
calexium_lib/net_services_protocols/logger_service.anubis
@@ -20,9 +20,13 @@ read calexium_lib/CXM_message_constants.anubis @@ -20,9 +20,13 @@ read calexium_lib/CXM_message_constants.anubis
20 read calexium_lib/net_services/CXM_net_services.anubis 20 read calexium_lib/net_services/CXM_net_services.anubis
21 read calexium_lib/net_services/CXM_generic_protocol.anubis 21 read calexium_lib/net_services/CXM_generic_protocol.anubis
22 22
23 -//read NetBox_types.anubis  
24 -//read mailfountain_types.anubis  
25 -//read tools/mf_loggers.anubis 23 +// Special non-existing file. This is a work arround for a impossibility to define global configuration in anubis.
  24 +// So this file allows you to specify on which UDP port the logger server is listening.
  25 +// You have to provide this file in your base source directory (or any other folder which is scanned by the compilater,
  26 +// and you define a function named 'logger_port' which simply return the port number as an Int32.
  27 +// Example:
  28 +// public define Int32 logger_port = 33610.
  29 +read logger_config.anubis
26 30
27 public define Int32 logger_srv_version = 1. 31 public define Int32 logger_srv_version = 1.
28 32
@@ -212,20 +216,19 @@ define One @@ -212,20 +216,19 @@ define One
212 public define Maybe(UDP_Server) 216 public define Maybe(UDP_Server)
213 start_logger_server 217 start_logger_server
214 ( 218 (
215 - Int32 port,  
216 List(Logger) logs, 219 List(Logger) logs,
217 Logger debug_logger 220 Logger debug_logger
218 ) = 221 ) =
219 if start_udp_server(0, 222 if start_udp_server(0,
220 - port, 223 + logger_port,
221 make_udp_handler(logs, debug_logger), 224 make_udp_handler(logs, debug_logger),
222 8*1024, 225 8*1024,
223 my_notify) is 226 my_notify) is
224 { 227 {
225 cannot_create_the_socket then logError(debug_logger, "Cannot create the listening socket."); failure, 228 cannot_create_the_socket then logError(debug_logger, "Cannot create the listening socket."); failure,
226 - cannot_bind_address_port then logError(debug_logger, "Cannot bind to port 33610.");failure,  
227 - access_denied then logError(debug_logger, "Cannot listen on port 33610.");failure,  
228 - ok(server) then logInfo(debug_logger, "LocalLog Server started on port 33610."); success(server) 229 + cannot_bind_address_port then logError(debug_logger, "Cannot bind to port " + logger_port + ".");failure,
  230 + access_denied then logError(debug_logger, "Cannot listen on port " + logger_port + ".");failure,
  231 + ok(server) then logInfo(debug_logger, "LocalLog Server started on port " + logger_port + "."); success(server)
229 }. 232 }.
230 233
231 234
@@ -266,7 +269,7 @@ define One @@ -266,7 +269,7 @@ define One
266 String logger_server, 269 String logger_server,
267 Message log_message 270 Message log_message
268 )= 271 )=
269 - forget(send_message_by_udp(log_message, ip_address((127,0,0,1)), 33610)). 272 + forget(send_message_by_udp(log_message, ip_address((127,0,0,1)), logger_port)).
270 273
271 /* if find_string(log_message, "LogString") is 274 /* if find_string(log_message, "LogString") is
272 { 275 {