osuosl / formsender

Simple script to email form submissions.
Apache License 2.0
3 stars 1 forks source link

Add Logging #42

Closed matthewrsj closed 9 years ago

matthewrsj commented 9 years ago

Work In Progress, posted for review.

matthewrsj commented 9 years ago

Produces this type of output when tests are run:

2015-09-14 09:30:53,885 INFO sending email
2015-09-14 09:30:53,894 WARNING formsender received Duplicate Request
2015-09-14 09:30:53,896 WARNING formsender received Too Many Requests
2015-09-14 09:30:53,899 INFO sending email
2015-09-14 09:30:53,918 INFO sending email
2015-09-14 09:30:53,977 WARNING formsender received Invalid Email
2015-09-14 09:30:53,980 WARNING formsender received Invalid Name
2015-09-14 09:30:53,984 WARNING formsender received Improper Form Submission
2015-09-14 09:30:53,984 WARNING formsender received Improper Form Submission
2015-09-14 09:30:53,989 INFO sending email
2015-09-14 09:30:53,989 INFO sending email
2015-09-14 09:30:54,001 WARNING formsender received Duplicate Request
2015-09-14 09:30:54,028 WARNING formsender received Too Many Requests
2015-09-14 09:30:54,028 WARNING formsender received Too Many Requests
2015-09-14 09:30:54,032 INFO sending email
2015-09-14 09:30:54,067 INFO sending email
2015-09-14 09:30:54,077 WARNING formsender received Duplicate Request
2015-09-14 09:30:54,077 WARNING formsender received Duplicate Request
2015-09-14 09:30:54,077 WARNING formsender received Duplicate Request
2015-09-14 09:30:54,098 WARNING formsender received Invalid Email
2015-09-14 09:30:54,098 WARNING formsender received Invalid Email
2015-09-14 09:30:54,109 WARNING formsender received Improper Form Submission
2015-09-14 09:30:54,109 WARNING formsender received Improper Form Submission
2015-09-14 09:30:54,117 WARNING formsender received Invalid Name
2015-09-14 09:30:54,117 WARNING formsender received Invalid Name
2015-09-14 09:30:54,123 WARNING formsender received Improper Form Submission
2015-09-14 09:30:54,135 INFO sending email
2015-09-14 09:30:54,135 INFO sending email
matthewrsj commented 9 years ago

Produces this type of output when tests are run:

2015-09-14 10:05:19,106 INFO sending email to: example@osuosl.org
2015-09-14 10:05:19,119 WARNING formsender received Duplicate Request: Valid Guy from example@osuosl.org
2015-09-14 10:05:19,119 WARNING formsender received Duplicate Request: Valid Guy from example@osuosl.org
2015-09-14 10:05:19,195 INFO sending email to: example@osuosl.org
2015-09-14 10:05:19,209 WARNING formsender received Invalid Email: nope@example.com from nope@example.com
2015-09-14 10:05:19,215 WARNING formsender received Invalid Name:  from example@osuosl.org
2015-09-14 10:05:19,219 WARNING formsender received Improper Form Submission: Valid Guy from example@osuosl.org
2015-09-14 10:05:19,224 INFO sending email to: example@osuosl.org
2015-09-14 10:05:19,234 WARNING formsender received Duplicate Request: Valid Guy from example@osuosl.org
2015-09-14 10:05:19,344 WARNING formsender received Invalid Name:     from example@osuosl.org
2015-09-14 10:05:19,359 INFO sending email to: example@osuosl.org
tschuy commented 9 years ago

That format looks pretty greppable to me. I wouldn't mind reading logs formatted like that.

Kennric commented 9 years ago

That format looks pretty good to me too. Get another opinion from one of the sysadmins, though. +1

matthewrsj commented 9 years ago

Produces this type of output when tests are run:

Sep 14 16:34:04 silver INFO formsender: sending email to: example@osuosl.org
Sep 14 16:34:04 silver WARNING formsender: received Duplicate Request: Valid Guy from example@osuosl.org
Sep 14 16:34:04 silver WARNING formsender: received Too Many Requests: Valid Guy from example@osuosl.org
Sep 14 16:34:04 silver INFO formsender: sending email to: example@osuosl.org
Sep 14 16:34:04 silver INFO formsender: sending email to: example@osuosl.org
Sep 14 16:34:05 silver WARNING formsender: received Invalid Email: nope@example.com from nope@example.com
Sep 14 16:34:05 silver WARNING formsender: received Invalid Name:  from example@osuosl.org
Sep 14 16:34:05 silver WARNING formsender: received Improper Form Submission: Valid Guy from example@osuosl.org
Sep 14 16:34:05 silver INFO formsender: sending email to: example@osuosl.org
Sep 14 16:34:05 silver WARNING formsender: received Duplicate Request: Valid Guy from example@osuosl.org
Sep 14 16:34:05 silver WARNING formsender: received Duplicate Request: Valid Guy from example@osuosl.org
Sep 14 16:34:05 silver WARNING formsender: received Duplicate Request: Valid Guy from example@osuosl.org
Sep 14 16:34:05 silver WARNING formsender: received Duplicate Request: Valid Guy from example@osuosl.org
Sep 14 16:34:05 silver INFO formsender: sending email to: example@osuosl.org
Sep 14 16:34:05 silver INFO formsender: sending email to: example@osuosl.org
jordane commented 9 years ago

@matthewrsj Is it possible for a single event to trigger multiple log lines?

matthewrsj commented 9 years ago

I'm sure there is a way @jordane, what do you want to see?

jordane commented 9 years ago

@matthewrsj I was just going to suggest using a unique token to tie together multiple log lines. If there is only one line per event, then no need to worry about that.

+1