Commit 44507542f6eff29204eb951212ebb4a44af87016

Authored by totoro
1 parent 130e2414

mistake in comment

Showing 1 changed file with 397 additions and 397 deletions   Show diff stats
net_services_protocols/logger_service.anubis
1   -/*
2   - *
3   - * User: David RENE
4   - * Date: 29/07/2007
5   - * Time: 02:04
6   - * (c) Calexium
7   - *
8   - */
9   -
10   -read tools/basis.anubis
11   -read system/muscle.anubis
12   -read system/data_io.anubis
13   -read system/convert.anubis
14   -read system/string.anubis
15   -read system/logger.anubis
16   -read system/message_queue.anubis
17   -read system/message_transceiver.anubis
18   -
19   -read calexium_lib/CXM_message_constants.anubis
20   -read calexium_lib/net_services/CXM_net_services.anubis
21   -read calexium_lib/net_services/CXM_generic_protocol.anubis
22   -
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 Word32.
27   -// Example:
28   -// public define Word32 logger_port = 33610.
29   - read logger_config.anubis
30   -
31   -// previous 'read' replaced by an empty declaration. Should be defined into main source file.
32   -public define Word32 logger_port.
33   -
34   -public define Word32 logger_srv_version = 1.
35   -
36   - /**
37   - * has_update scan the given message for finding corresponding available update
38   - * package for the application. The request message come with AppId field which contain
39   - * package or application signature and CurrentVersion field which is current version
40   - * installed on the requester.
41   - *
42   - * --- REQUEST message format
43   - * msg [_CXM_UPD_HAS_UPDATE]
44   - * string "AppId" = hash or unique signature of the package
45   - * string "CurrentVersion" = current version installed on the remote caller
46   - *
47   - * --- ANSWER message format
48   - *
49   - * ERROR case message format
50   - * msg [_CXM_ACK]
51   - * int32 "CMD" = _CXM_UPD_HAS_UPDATE
52   - * int32 "STATUS" = _CXM_ERROR
53   - *
54   - * OK without update available
55   - * msg [_CXM_ACK]
56   - * int32 "CMD" = _CXM_UPD_HAS_UPDATE
57   - * int32 "STATUS" = _CXM_OK
58   - * msg "RESULT" [_CXM_ACK_RESULT_MSG]
59   - * int32 "PackageStatus" = no_update // numerical value = 0
60   - *
61   - */
62   -
63   -define Bool
64   - process_log
65   - (
66   - Logger log,
67   - Message msg
68   - )=
69   - if find_string(msg, "LogString") is
70   - {
71   - failure then logError(log, "process_log can't find LogString");false,
72   - success(log_string) then
73   - if find_int32(msg, "Level") is
74   - {
75   - failure then logError(log, "process_log can't find Level");false,
76   - success(int_level) then
77   - if find_int32(msg, "Thread") is
78   - {
79   - failure then logError(log, "process_log can't find Level");false,
80   - success(thread_id) then
81   - with level = get_LogLevel_from_value(to_Int(int_level)),
82   - if level is logTrace then
83   - if find_string(msg, "LogMask") is
84   - {
85   - failure then logError(log, "process_log can't find LogMask");false,
86   - success(log_mask) then logTrace(log, logMask(log_mask), log_string, thread_id); true
87   - }
88   - else doLog(log, log_string, level, thread_id); true
89   -// {
90   -// logNone then true,
91   -// logCriticalError then logCriticalError(log, log_string); true,
92   -// logError then logError(log, log_string); true,
93   -// logWarning then logWarning(log, log_string); true,
94   -// logInfo then logInfo(log, log_string); true,
95   -// logDebug then logDebug(log, log_string); true
96   -// logTrace then
97   -// if find_string(msg, "LogMask") is
98   -// {
99   -// failure then logError(log, "process_log can't find LogMask");false,
100   -// success(log_mask) then logTrace(log, logMask(log_mask),log_string); true
101   -// }
102   -// }
103   - }
104   - }
105   - }.
106   -
107   -define Bool
108   - process_log
109   - (
110   - List(Logger) logs,
111   - Message msg
112   - )=
113   - if find_string(msg, "LogName") is
114   - {
115   - failure then println("process_log can't find LogName");false,
116   - success(log_name) then
117   - if get_logger(logs, log_name) is
118   - {
119   - failure then println("can't find log ["+log_name+"]");false,
120   - success(log) then process_log(log, msg)
121   - }
122   - }.
123   -
124   - /** message_received is the principal
125   - */
126   - /*
127   - define One
128   - message_received
129   - (
130   - MessageQueue queue,
131   - List(Logger) logs,
132   - Message msg
133   - )=
134   - with msg_what = *msg.what,
135   - if msg_what = _CXM_LOGGER_LOG then
136   - send_result(queue, _CXM_LOGGER_LOG, process_log(logs, msg))
137   - else
138   - println("wrong message_received is not _CXM_LOGGER_LOG ");unique
139   - .
140   -
141   - define One
142   - logger_handler
143   - (
144   - MessageQueue queue,
145   - List(Logger) logs
146   - )=
147   - if queue.get_next_received_Message(1) is
148   - {
149   - timeout then //println("logger_handler timeout ["+queue.get_name(unique)+"]");
150   - logger_handler(queue, logs),
151   - closed then //println("logger_handler closed ["+queue.get_name(unique)+"]");
152   - unique,
153   - msg(msg) then //println("logger_handler msg received ["+queue.get_name(unique)+"]");
154   - message_received(queue, logs, msg);
155   - logger_handler(queue, logs)
156   - }.
157   -
158   - public define NetService
159   - logger_service
160   - (
161   - List(Logger) logs
162   - )=
163   - net_service(
164   - logger_srv_version,
165   - _CXM_LOGGER_SERVICE_ID, //id of the service declared in CXM_message_constants
166   - "Logger service", //human readable name of the service
167   - (
168   - MessageQueue queue,
169   - String peer
170   - ) |-> logger_handler(queue, logs)).
171   -
172   - */
173   - /****************** LOCAL UDP SERVICE *************/
174   -
175   -
176   -public define String
177   - data_preview
178   - (
179   - ByteArray data,
180   - Int max
181   - ) =
182   - with l = length(data),
183   - firsts_bytes = extract(data, 0, max),
184   - "Length=" + l + "; String='"+to_string(firsts_bytes)+"' Buffer=[" + to_ascii(firsts_bytes) + (if l > max then "...]" else "]").
185   -
186   -
187   -define (UDP_Socket, ByteArray, Truncation, Word32, Word32) -> One
188   - make_udp_handler
189   - (
190   - List(Logger) logs,
191   - Logger debug_logger
192   - ) =
193   - (
194   - UDP_Socket socket,
195   - ByteArray data,
196   - Truncation truncation,
197   - Word32 ip_address,
198   - Word32 ip_port
199   - ) |->
200   - with ip = ip_addr_to_string(ip_address),
201   - logTrace(debug_logger, logMask("Logger"), "LoggerServer: data received (" + length(data) + " bytes) from IP " + ip + "... ");
202   - if receive_message_from_io(make_data_io(data)) is
203   - {
204   - failure then logWarning(debug_logger, "LoggerServer: Bad data packet received from IP " + ip + ": " + data_preview(data, 20)),
205   - success(msg) then
206   - if *msg.what = _CXM_LOGGER_LOG then
207   - forget(process_log(logs, msg))
208   - else
209   - println("LoggerService: wrong message_received. [" + to_hexa(*msg.what) + "] is not _CXM_LOGGER_LOG ")
210   - }.
211   -
212   -define One
213   - my_notify
214   - (
215   - One dummy
216   - ) =
217   - unique.
218   -
219   -public define Maybe(UDP_Server)
220   - start_logger_server
221   - (
222   - List(Logger) logs,
223   - Logger debug_logger
224   - ) =
225   - if start_udp_server(0,
226   - logger_port,
227   - make_udp_handler(logs, debug_logger),
228   - 8*1024,
229   - my_notify) is
230   - {
231   - cannot_create_the_socket then logError(debug_logger, "Cannot create the listening socket."); failure,
232   - cannot_bind_address_port then logError(debug_logger, "Cannot bind to port " + logger_port + ".");failure,
233   - access_denied then logError(debug_logger, "Cannot listen on port " + logger_port + ".");failure,
234   - ok(server) then logInfo(debug_logger, "LocalLog Server started on port " + logger_port + "."); success(server)
235   - }.
236   -
237   -
238   - /****************** CLIENT PART *******************/
239   -
240   -define One
241   - local_net_logger
242   - (
243   - String logger_server,
244   - Message log_message
245   - )=
246   - forget(send_message_by_udp(log_message, ip_address((127,0,0,1)), logger_port)).
247   -
248   -
249   -define Message
250   - create_log_msg
251   - (
252   - String logger_name,
253   - String log_string,
254   - Int level
255   - )=
256   - with string = if length(log_string) > 1024 then (if sub_string(log_string, 0, 1024) is success(s) then s else "?") + "..."
257   - else log_string,
258   - with log_msg = message(_CXM_LOGGER_LOG),
259   - forget(add_string(log_msg, "LogName", logger_name));
260   - forget(add_string(log_msg, "LogString", string));
261   - forget(add_int32(log_msg, "Level", truncate_to_Word32(level)));
262   - forget(add_int32(log_msg, "Thread", virtual_machine_id));
263   - log_msg
264   - .
265   -*/
266   -
267   -// HACK Begin of Hacked version
268   - define String debug_log = "Debug".
269   - define String config_log = "Config".
270   - define String incoming_log = "Incoming".
271   - define String outgoing_log = "Outgoing".
272   - define String pop3_log = "POP3".
273   - define String mailing_log = "Mailing".
274   - define String errors_log = "Errors".
275   - define String security_log = "Security".
276   - define String spams_log = "Spams".
277   - define String api_log = "MF_API".
278   - define String internal_log = "INTERNAL".
279   -
280   -
281   - define String
282   - get_log_file
283   - (
284   - String log_name
285   - ) =
286   - if log_name = debug_log then "debug.log"
287   - else if log_name = "SendMail" then "debug.log"
288   - else if log_name = config_log then "config.log"
289   - else if log_name = incoming_log then "incoming.log"
290   - else if log_name = outgoing_log then "outgoing.log"
291   - else if log_name = pop3_log then "pop3.log"
292   - else if log_name = mailing_log then "mailing.log"
293   - else if log_name = errors_log then "errors.log"
294   - else if log_name = "DB" then "errors.log"
295   - else if log_name = "SQL" then "sql_profiling.log"
296   - else if log_name = security_log then "security.log"
297   - else if log_name = spams_log then "spams.log"
298   - else if log_name = api_log then "api.log"
299   - else if log_name = internal_log then "internal"
300   - else "unknown.log".
301   -
302   -
303   - define One
304   - local_net_logger
305   - (
306   - String logger_server,
307   - One _
308   - )=
309   - unique.
310   -
311   - define One
312   - create_log_msg
313   - (
314   - String logger_name,
315   - String log_string,
316   - Int level
317   - )=
318   - with log = createLogger(logger_name, 8, "/var/MailFountain/log/" + get_log_file(logger_name), logTrace, logTrace),
319   - logLevel = get_LogLevel_from_value(level),
320   - protect
321   - doLog(log, log_string, logLevel, virtual_machine_id).
322   -
323   -// HACK End of Hacked version
324   -
325   -
326   -
327   -public define One
328   - log(
329   - LogLevel level,
330   - String logger_name,
331   - String log_string
332   - )=
333   - local_net_logger("127.0.0.1", create_log_msg(logger_name, log_string, get_log_level_value(level))).
334   -
335   -public define One
336   - logNone(
337   - String logger_name,
338   - String log_string
339   - )=
340   - local_net_logger("127.0.0.1", create_log_msg(logger_name, log_string, 0)).
341   -
342   -public define One
343   - logCriticalError(
344   - String logger_name,
345   - String log_string
346   - )=
347   - local_net_logger("127.0.0.1", create_log_msg(logger_name, log_string, 1)).
348   -
349   -public define One
350   - logError(
351   - String logger_name,
352   - String log_string
353   - )=
354   - local_net_logger("127.0.0.1", create_log_msg(logger_name, log_string, 2)).
355   -
356   -public define One
357   - logWarning(
358   - String logger_name,
359   - String log_string
360   - )=
361   - local_net_logger("127.0.0.1", create_log_msg(logger_name, log_string, 3)).
362   -
363   -public define One
364   - logInfo(
365   - String logger_name,
366   - String log_string
367   - )=
368   - local_net_logger("127.0.0.1", create_log_msg(logger_name, log_string, 4)).
369   -
370   -public define One
371   - logDebug(
372   - String logger_name,
373   - String log_string
374   - )=
375   - local_net_logger("127.0.0.1", create_log_msg(logger_name, log_string, 5)).
376   -
377   -public define One
378   - logTrace(
379   - String logger_name,
380   - LogMask log_mask,
381   - String log_string
382   - )=
383   - with log_msg = create_log_msg(logger_name, log_string, 6),
384   - forget(add_string(log_msg, "LogMask", log_mask.mask));
385   - local_net_logger("127.0.0.1", log_msg).
386   -
387   -// HACK hacked version
388   - public define One
389   - logTrace(
390   - String logger_name,
391   - LogMask log_mask,
392   - String log_string
393   - )=
394   - if log_mask is logMask(mask) then
395   - if mask = "send_mail" | mask = "smtp" | mask = "sql_profiling" then
396   - local_net_logger("127.0.0.1", create_log_msg(logger_name, log_string, 6))
397   - else unique.
  1 +/*
  2 + *
  3 + * User: David RENE
  4 + * Date: 29/07/2007
  5 + * Time: 02:04
  6 + * (c) Calexium
  7 + *
  8 + */
  9 +
  10 +read tools/basis.anubis
  11 +read system/muscle.anubis
  12 +read system/data_io.anubis
  13 +read system/convert.anubis
  14 +read system/string.anubis
  15 +read system/logger.anubis
  16 +read system/message_queue.anubis
  17 +read system/message_transceiver.anubis
  18 +
  19 +read calexium_lib/CXM_message_constants.anubis
  20 +read calexium_lib/net_services/CXM_net_services.anubis
  21 +read calexium_lib/net_services/CXM_generic_protocol.anubis
  22 +
  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 compiler,
  26 +// and you define a function named 'logger_port' which simply return the port number as an Word32.
  27 +// Example:
  28 +// public define Word32 logger_port = 33610.
  29 + read logger_config.anubis
  30 +
  31 +// previous 'read' replaced by an empty declaration. Should be defined into main source file.
  32 +public define Word32 logger_port.
  33 +
  34 +public define Word32 logger_srv_version = 1.
  35 +
  36 + /**
  37 + * has_update scan the given message for finding corresponding available update
  38 + * package for the application. The request message come with AppId field which contain
  39 + * package or application signature and CurrentVersion field which is current version
  40 + * installed on the requester.
  41 + *
  42 + * --- REQUEST message format
  43 + * msg [_CXM_UPD_HAS_UPDATE]
  44 + * string "AppId" = hash or unique signature of the package
  45 + * string "CurrentVersion" = current version installed on the remote caller
  46 + *
  47 + * --- ANSWER message format
  48 + *
  49 + * ERROR case message format
  50 + * msg [_CXM_ACK]
  51 + * int32 "CMD" = _CXM_UPD_HAS_UPDATE
  52 + * int32 "STATUS" = _CXM_ERROR
  53 + *
  54 + * OK without update available
  55 + * msg [_CXM_ACK]
  56 + * int32 "CMD" = _CXM_UPD_HAS_UPDATE
  57 + * int32 "STATUS" = _CXM_OK
  58 + * msg "RESULT" [_CXM_ACK_RESULT_MSG]
  59 + * int32 "PackageStatus" = no_update // numerical value = 0
  60 + *
  61 + */
  62 +
  63 +define Bool
  64 + process_log
  65 + (
  66 + Logger log,
  67 + Message msg
  68 + )=
  69 + if find_string(msg, "LogString") is
  70 + {
  71 + failure then logError(log, "process_log can't find LogString");false,
  72 + success(log_string) then
  73 + if find_int32(msg, "Level") is
  74 + {
  75 + failure then logError(log, "process_log can't find Level");false,
  76 + success(int_level) then
  77 + if find_int32(msg, "Thread") is
  78 + {
  79 + failure then logError(log, "process_log can't find Level");false,
  80 + success(thread_id) then
  81 + with level = get_LogLevel_from_value(to_Int(int_level)),
  82 + if level is logTrace then
  83 + if find_string(msg, "LogMask") is
  84 + {
  85 + failure then logError(log, "process_log can't find LogMask");false,
  86 + success(log_mask) then logTrace(log, logMask(log_mask), log_string, thread_id); true
  87 + }
  88 + else doLog(log, log_string, level, thread_id); true
  89 +// {
  90 +// logNone then true,
  91 +// logCriticalError then logCriticalError(log, log_string); true,
  92 +// logError then logError(log, log_string); true,
  93 +// logWarning then logWarning(log, log_string); true,
  94 +// logInfo then logInfo(log, log_string); true,
  95 +// logDebug then logDebug(log, log_string); true
  96 +// logTrace then
  97 +// if find_string(msg, "LogMask") is
  98 +// {
  99 +// failure then logError(log, "process_log can't find LogMask");false,
  100 +// success(log_mask) then logTrace(log, logMask(log_mask),log_string); true
  101 +// }
  102 +// }
  103 + }
  104 + }
  105 + }.
  106 +
  107 +define Bool
  108 + process_log
  109 + (
  110 + List(Logger) logs,
  111 + Message msg
  112 + )=
  113 + if find_string(msg, "LogName") is
  114 + {
  115 + failure then println("process_log can't find LogName");false,
  116 + success(log_name) then
  117 + if get_logger(logs, log_name) is
  118 + {
  119 + failure then println("can't find log ["+log_name+"]");false,
  120 + success(log) then process_log(log, msg)
  121 + }
  122 + }.
  123 +
  124 + /** message_received is the principal
  125 + */
  126 + /*
  127 + define One
  128 + message_received
  129 + (
  130 + MessageQueue queue,
  131 + List(Logger) logs,
  132 + Message msg
  133 + )=
  134 + with msg_what = *msg.what,
  135 + if msg_what = _CXM_LOGGER_LOG then
  136 + send_result(queue, _CXM_LOGGER_LOG, process_log(logs, msg))
  137 + else
  138 + println("wrong message_received is not _CXM_LOGGER_LOG ");unique
  139 + .
  140 +
  141 + define One
  142 + logger_handler
  143 + (
  144 + MessageQueue queue,
  145 + List(Logger) logs
  146 + )=
  147 + if queue.get_next_received_Message(1) is
  148 + {
  149 + timeout then //println("logger_handler timeout ["+queue.get_name(unique)+"]");
  150 + logger_handler(queue, logs),
  151 + closed then //println("logger_handler closed ["+queue.get_name(unique)+"]");
  152 + unique,
  153 + msg(msg) then //println("logger_handler msg received ["+queue.get_name(unique)+"]");
  154 + message_received(queue, logs, msg);
  155 + logger_handler(queue, logs)
  156 + }.
  157 +
  158 + public define NetService
  159 + logger_service
  160 + (
  161 + List(Logger) logs
  162 + )=
  163 + net_service(
  164 + logger_srv_version,
  165 + _CXM_LOGGER_SERVICE_ID, //id of the service declared in CXM_message_constants
  166 + "Logger service", //human readable name of the service
  167 + (
  168 + MessageQueue queue,
  169 + String peer
  170 + ) |-> logger_handler(queue, logs)).
  171 +
  172 + */
  173 + /****************** LOCAL UDP SERVICE *************/
  174 +
  175 +
  176 +public define String
  177 + data_preview
  178 + (
  179 + ByteArray data,
  180 + Int max
  181 + ) =
  182 + with l = length(data),
  183 + firsts_bytes = extract(data, 0, max),
  184 + "Length=" + l + "; String='"+to_string(firsts_bytes)+"' Buffer=[" + to_ascii(firsts_bytes) + (if l > max then "...]" else "]").
  185 +
  186 +
  187 +define (UDP_Socket, ByteArray, Truncation, Word32, Word32) -> One
  188 + make_udp_handler
  189 + (
  190 + List(Logger) logs,
  191 + Logger debug_logger
  192 + ) =
  193 + (
  194 + UDP_Socket socket,
  195 + ByteArray data,
  196 + Truncation truncation,
  197 + Word32 ip_address,
  198 + Word32 ip_port
  199 + ) |->
  200 + with ip = ip_addr_to_string(ip_address),
  201 + logTrace(debug_logger, logMask("Logger"), "LoggerServer: data received (" + length(data) + " bytes) from IP " + ip + "... ");
  202 + if receive_message_from_io(make_data_io(data)) is
  203 + {
  204 + failure then logWarning(debug_logger, "LoggerServer: Bad data packet received from IP " + ip + ": " + data_preview(data, 20)),
  205 + success(msg) then
  206 + if *msg.what = _CXM_LOGGER_LOG then
  207 + forget(process_log(logs, msg))
  208 + else
  209 + println("LoggerService: wrong message_received. [" + to_hexa(*msg.what) + "] is not _CXM_LOGGER_LOG ")
  210 + }.
  211 +
  212 +define One
  213 + my_notify
  214 + (
  215 + One dummy
  216 + ) =
  217 + unique.
  218 +
  219 +public define Maybe(UDP_Server)
  220 + start_logger_server
  221 + (
  222 + List(Logger) logs,
  223 + Logger debug_logger
  224 + ) =
  225 + if start_udp_server(0,
  226 + logger_port,
  227 + make_udp_handler(logs, debug_logger),
  228 + 8*1024,
  229 + my_notify) is
  230 + {
  231 + cannot_create_the_socket then logError(debug_logger, "Cannot create the listening socket."); failure,
  232 + cannot_bind_address_port then logError(debug_logger, "Cannot bind to port " + logger_port + ".");failure,
  233 + access_denied then logError(debug_logger, "Cannot listen on port " + logger_port + ".");failure,
  234 + ok(server) then logInfo(debug_logger, "LocalLog Server started on port " + logger_port + "."); success(server)
  235 + }.
  236 +
  237 +
  238 + /****************** CLIENT PART *******************/
  239 +
  240 +define One
  241 + local_net_logger
  242 + (
  243 + String logger_server,
  244 + Message log_message
  245 + )=
  246 + forget(send_message_by_udp(log_message, ip_address((127,0,0,1)), logger_port)).
  247 +
  248 +
  249 +define Message
  250 + create_log_msg
  251 + (
  252 + String logger_name,
  253 + String log_string,
  254 + Int level
  255 + )=
  256 + with string = if length(log_string) > 1024 then (if sub_string(log_string, 0, 1024) is success(s) then s else "?") + "..."
  257 + else log_string,
  258 + with log_msg = message(_CXM_LOGGER_LOG),
  259 + forget(add_string(log_msg, "LogName", logger_name));
  260 + forget(add_string(log_msg, "LogString", string));
  261 + forget(add_int32(log_msg, "Level", truncate_to_Word32(level)));
  262 + forget(add_int32(log_msg, "Thread", virtual_machine_id));
  263 + log_msg
  264 + .
  265 +*/
  266 +
  267 +// HACK Begin of Hacked version
  268 + define String debug_log = "Debug".
  269 + define String config_log = "Config".
  270 + define String incoming_log = "Incoming".
  271 + define String outgoing_log = "Outgoing".
  272 + define String pop3_log = "POP3".
  273 + define String mailing_log = "Mailing".
  274 + define String errors_log = "Errors".
  275 + define String security_log = "Security".
  276 + define String spams_log = "Spams".
  277 + define String api_log = "MF_API".
  278 + define String internal_log = "INTERNAL".
  279 +
  280 +
  281 + define String
  282 + get_log_file
  283 + (
  284 + String log_name
  285 + ) =
  286 + if log_name = debug_log then "debug.log"
  287 + else if log_name = "SendMail" then "debug.log"
  288 + else if log_name = config_log then "config.log"
  289 + else if log_name = incoming_log then "incoming.log"
  290 + else if log_name = outgoing_log then "outgoing.log"
  291 + else if log_name = pop3_log then "pop3.log"
  292 + else if log_name = mailing_log then "mailing.log"
  293 + else if log_name = errors_log then "errors.log"
  294 + else if log_name = "DB" then "errors.log"
  295 + else if log_name = "SQL" then "sql_profiling.log"
  296 + else if log_name = security_log then "security.log"
  297 + else if log_name = spams_log then "spams.log"
  298 + else if log_name = api_log then "api.log"
  299 + else if log_name = internal_log then "internal"
  300 + else "unknown.log".
  301 +
  302 +
  303 + define One
  304 + local_net_logger
  305 + (
  306 + String logger_server,
  307 + One _
  308 + )=
  309 + unique.
  310 +
  311 + define One
  312 + create_log_msg
  313 + (
  314 + String logger_name,
  315 + String log_string,
  316 + Int level
  317 + )=
  318 + with log = createLogger(logger_name, 8, "/var/MailFountain/log/" + get_log_file(logger_name), logTrace, logTrace),
  319 + logLevel = get_LogLevel_from_value(level),
  320 + protect
  321 + doLog(log, log_string, logLevel, virtual_machine_id).
  322 +
  323 +// HACK End of Hacked version
  324 +
  325 +
  326 +
  327 +public define One
  328 + log(
  329 + LogLevel level,
  330 + String logger_name,
  331 + String log_string
  332 + )=
  333 + local_net_logger("127.0.0.1", create_log_msg(logger_name, log_string, get_log_level_value(level))).
  334 +
  335 +public define One
  336 + logNone(
  337 + String logger_name,
  338 + String log_string
  339 + )=
  340 + local_net_logger("127.0.0.1", create_log_msg(logger_name, log_string, 0)).
  341 +
  342 +public define One
  343 + logCriticalError(
  344 + String logger_name,
  345 + String log_string
  346 + )=
  347 + local_net_logger("127.0.0.1", create_log_msg(logger_name, log_string, 1)).
  348 +
  349 +public define One
  350 + logError(
  351 + String logger_name,
  352 + String log_string
  353 + )=
  354 + local_net_logger("127.0.0.1", create_log_msg(logger_name, log_string, 2)).
  355 +
  356 +public define One
  357 + logWarning(
  358 + String logger_name,
  359 + String log_string
  360 + )=
  361 + local_net_logger("127.0.0.1", create_log_msg(logger_name, log_string, 3)).
  362 +
  363 +public define One
  364 + logInfo(
  365 + String logger_name,
  366 + String log_string
  367 + )=
  368 + local_net_logger("127.0.0.1", create_log_msg(logger_name, log_string, 4)).
  369 +
  370 +public define One
  371 + logDebug(
  372 + String logger_name,
  373 + String log_string
  374 + )=
  375 + local_net_logger("127.0.0.1", create_log_msg(logger_name, log_string, 5)).
  376 +
  377 +public define One
  378 + logTrace(
  379 + String logger_name,
  380 + LogMask log_mask,
  381 + String log_string
  382 + )=
  383 + with log_msg = create_log_msg(logger_name, log_string, 6),
  384 + forget(add_string(log_msg, "LogMask", log_mask.mask));
  385 + local_net_logger("127.0.0.1", log_msg).
  386 +
  387 +// HACK hacked version
  388 + public define One
  389 + logTrace(
  390 + String logger_name,
  391 + LogMask log_mask,
  392 + String log_string
  393 + )=
  394 + if log_mask is logMask(mask) then
  395 + if mask = "send_mail" | mask = "smtp" | mask = "sql_profiling" then
  396 + local_net_logger("127.0.0.1", create_log_msg(logger_name, log_string, 6))
  397 + else unique.
... ...