[Feedback] add mail logger

Review Request #320 — Created July 7, 2014 and discarded

tardypad
Lunr
tardypad:mail_logger
330
lunr
Feedback: add mail logger
Unit tests
  • 0
  • 0
  • 13
  • 0
  • 13
Description From Last Updated
tardypad
dinos
  1. 
      
  2. src/Lunr/Feedback/MailLogger.php (Diff revision 1)
     
     
    Not really the way we write documentation. I believe that @var Array is enough, but if you want to write more details add an extra empty line after the detailed description.
  3. src/Lunr/Feedback/MailLogger.php (Diff revision 1)
     
     
    extra line :)
  4. src/Lunr/Feedback/MailLogger.php (Diff revision 1)
     
     
    The function names in Lunr are snake case. 
    
    Be sure to fix the rest as well.
  5. src/Lunr/Feedback/MailLogger.php (Diff revision 1)
     
     
    variables also snake case, e.g. $email_to
  6. src/Lunr/Feedback/MailLogger.php (Diff revision 1)
     
     
    It's not a blocking issue and it's more of a personal thing but since 5.4 we define arrays with [] instead of array()
  7. src/Lunr/Feedback/Tests/MailLoggerBaseTest.php (Diff revision 1)
     
     
     
     
     
     
     
     
     
    too crowded. Give them a line after every semicolon.
  8. 
      
tardypad
pprkut
  1. 
      
  2. src/Lunr/Feedback/MailLogger.php (Diff revision 2)
     
     
    What in here requires PHP 5.5?
  3. src/Lunr/Feedback/MailLogger.php (Diff revision 2)
     
     
  4. src/Lunr/Feedback/MailLogger.php (Diff revision 2)
     
     
     
     
     
     
    Too vague. Please make separate parameters for to and from
  5. src/Lunr/Feedback/MailLogger.php (Diff revision 2)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    I see what you're trying to do here, but I don't think it's feasible to do it like this. To/From can only be set once, so checking on every call whether they are set is pretty pointless
    1. The problem is that the send function of Mail is resetting the To/From fields after a successful sending
      Thus we have to define them again before every log
      Or maybe we should change the Mail class itself?
    2. No, changing the Mail class would break re-entrance. You don't want that.
      The point here is not that you have to add the email addresses for every mail, but that you check whether they are there every time. You *know* after executing the constructor, so why do useless work?
    3. Alright, then this is already fixed in the new version
  6. src/Lunr/Feedback/MailLogger.php (Diff revision 2)
     
     
     
    You generally don't want to send an email if there is no "to" set. Missing an abort case
    1. The send function of the Mail class is already checking the presence of the To field before sending
      What do you mean by abort case?
    2. Relying on the Mail class means you still spend resources on creating a log message payload that you *know* will never be sent. So rather than doing useless work, just abort logging.
  7. src/Lunr/Feedback/MailLogger.php (Diff revision 2)
     
     
     
    This is a bit controversial. Ideally we already have the timestamp from the email, so this is really only useful if for some reason we send delayed information. That in turn should be more of a corner case, so I'd leave it up to the consumer to include that in the message.
    On the other hand, controller and method seem like a good information to have in the subject, and are rather useless in the message. So maybe override compose_message() and do it slightly differently here.
  8. 
      
tardypad
tardypad
tardypad
dinos
  1. 
      
  2. src/Lunr/Feedback/MailLogger.php (Diff revision 5)
     
     
    style :)
  3. 
      
tardypad
dinos
  1. Ship It!
  2. 
      
pprkut
  1. 
      
  2. src/Lunr/Feedback/MailLogger.php (Diff revision 6)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    Sorry, I know we had prior discussions on this and code wise it's fine. But I just found that half of this is done again in the Mail class so moving this functionality there entirely (in a separate review) makes more sense IMHO
  3. 
      
pprkut
  1. If we still want this (not sure) it would need to be ported to PHPMailer

    1. not used in 2 years, can be easily discarded

    2. well, the concept is still interesting and nothing speaks against such a feature. It would just need someone to bring it up-to-date

  2. 
      
tardypad
Review request changed

Status: Discarded

Change Summary:

Feedback was replaced by Monolog

Loading...