Commit ea89b389c0e35f2440498b88852830e7ea8d1cc3

Authored by Cédric RICARD
1 parent c5d52560

Improved logs into send_mail.anubis

Showing 1 changed file with 10 additions and 5 deletions   Show diff stats
calexium_lib/mail/send_mail.anubis
... ... @@ -361,8 +361,8 @@ public define SendContentResult
361 361 timeout then
362 362 if read_bytes(source, 65536) is
363 363 {
364   - failure then copy_error(so_far),
365   - time_out then copy_error(so_far),
  364 + failure then logError(send_mail_log, "send_content: failed to read input data_io"); copy_error(so_far),
  365 + time_out then logError(send_mail_log, "send_content: timeout reading input data_io"); copy_error(so_far),
366 366 success(buffer) then
367 367 if sm_flush( buffer, weaken(target) ) is
368 368 {
... ... @@ -412,22 +412,27 @@ define Reply_Result
412 412 RWStream conn,
413 413 List(Data_IO) mail_part
414 414 ) =
415   - //open the message file from the drive
  415 + with start_time = now,
416 416 if sm_copy_Data_IO_List_to_Stream(mail_part, conn, 0) is
417 417 {
418 418 smtp_reply(reply) then reply
419 419 copy_error(written) then
  420 + with finish_time = now,
420 421 logError(send_mail_log, "send_content: error sending data");
  422 + logTrace(send_mail_log, send_mail_mask, "send_content: "+written+" bytes sent in "+finish_time - start_time+" second(s)");
421 423 if written > 1024000 then
422 424 logInfo(send_mail_log, "send_content: may be due to over sized mail. Convert it to 452 error.");
423 425 reply(452, ["Error sending big email (more than 1 Mb)"])
424 426 else
425 427 error,
426   - copy_ok(_) then
  428 + copy_ok(size) then
427 429 if reliable_write(tcp(conn), [crlf_dot_crlf]) is
428 430 {
429 431 failure then logError(send_mail_log, "send_content: error writing CRLF.CRLF"); error,
430   - success(_) then receive_reply(conn)
  432 + success(_) then
  433 + with finish_time = (Int)now,
  434 + logTrace(send_mail_log, send_mail_mask, "mail sent "+size+" bytes in "+finish_time - start_time+" second(s)");
  435 + receive_reply(conn)
431 436 }
432 437 }.
433 438  
... ...