Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include message with emails #849

Merged
merged 6 commits into from Jan 28, 2016
Merged

Include message with emails #849

merged 6 commits into from Jan 28, 2016

Conversation

@Calvinp
Copy link
Contributor

Calvinp commented Jan 19, 2016

Now that Singularity has the capability to accept optional user messages for tasks, these messages can be included in any emails sent because of user actions with messages. This commit includes that ability.
It also includes the ability to set a variable, LOG_EMAILS_FOR_DEBUG - If this variable is set to true, all emails sent will be logged in the debug logs. This allows local testing of emails without an SMTP server.

Calvinp added 2 commits Jan 19, 2016
…essage will be sent in the header of any email that gets sent out becasue of that request.
@@ -287,6 +291,10 @@ private void prepareTaskMail(Optional<SingularityTask> task, SingularityTaskId t

final String body = Jade4J.render(taskTemplate, templateProperties);

if (LOG_EMAILS_FOR_DEBUG) {
LOG.debug("TheMail: " + body);

This comment has been minimized.

Copy link
@tpetr

tpetr Jan 19, 2016

Member

I'd suggest logging this at the LOG.trace() level instead, so that people can more easily control whether or not the email should be logged

if (LOG_EMAILS_FOR_DEBUG) {
LOG.debug("TheMail: " + body);
}

This comment has been minimized.

Copy link
@tpetr

tpetr Jan 19, 2016

Member

We should minimize the number of times the email body is logged -- i think just having this one here will suffice

@Calvinp
Copy link
Contributor Author

Calvinp commented Jan 20, 2016

These two issues have been fixed and the branch pushed again.

@Calvinp
Copy link
Contributor Author

Calvinp commented Jan 20, 2016

Whoops, I lied before, forgot about making it trace level. Now they're both fixed.

@@ -62,6 +68,10 @@ public void stop() {
}

public void queueMail(final List<String> toList, final List<String> ccList, final String subject, final String body) {
if (LOG_EMAILS_FOR_DEBUG) {
LOG.trace("TheMail: " + body);

This comment has been minimized.

Copy link
@ssalinas

ssalinas Jan 20, 2016

Member

We can do without the LOG_EMAILS_FOR_DEBUG. We can control the logging level for each class in the configuration for Singularity, so just putting it at trace should be enough.

Also for logging, you can so something more like this rather that using "string" + "string"

LOG.trace("Sending email: {}, to: {}, cc: {}", body, toList, ccList)

This comment has been minimized.

Copy link
@jhaber

jhaber Jan 20, 2016

Member

For readability I've found it to be easier to put the recipients first and the body last so you're not scrolling through a wall of HTML looking for the recipient at the end

@Calvinp
Copy link
Contributor Author

Calvinp commented Jan 20, 2016

Fixed

@@ -30,6 +30,8 @@

import io.dropwizard.lifecycle.Managed;



This comment has been minimized.

Copy link
@ssalinas

ssalinas Jan 20, 2016

Member

super nit-picky, but can we get rid of these extra new lines here and down by the LOG.trace

@Calvinp
Copy link
Contributor Author

Calvinp commented Jan 20, 2016

Not sure how those got there in the first place, but they're gone now.

@tpetr tpetr modified the milestone: 0.4.9 Jan 27, 2016
ssalinas added a commit that referenced this pull request Jan 28, 2016
Include message with emails
@ssalinas ssalinas merged commit 8f5fbf6 into master Jan 28, 2016
0 of 2 checks passed
0 of 2 checks passed
continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
continuous-integration/travis-ci/push The Travis CI build could not complete due to an error
Details
@ssalinas ssalinas deleted the include_message_with_emails branch Jan 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.