Most viewed recipes tagged "sns"http://code.activestate.com/recipes/tags/sns/views/2014-11-06T17:32:26-08:00ActiveState Code RecipesAmazon SNS handler for the logging module (Python) 2014-11-06T17:32:26-08:00Andrea Corbellinihttp://code.activestate.com/recipes/users/4186880/http://code.activestate.com/recipes/578956-amazon-sns-handler-for-the-logging-module/ <p style="color: grey"> Python recipe 578956 by <a href="/recipes/users/4186880/">Andrea Corbellini</a> (<a href="/recipes/tags/aws/">aws</a>, <a href="/recipes/tags/logging/">logging</a>, <a href="/recipes/tags/sns/">sns</a>). Revision 2. </p> <p>This is a handler for the standard <a href="https://docs.python.org/library/logging.html">logging</a> module that sends notifications to the <a href="http://aws.amazon.com/sns/">Amazon Simple Notification Service</a>.</p> <p>You can use it like so:</p> <pre class="prettyprint"><code>logging.config.dictConfig({ 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'verbose': { 'format': '%(levelname)s %(asctime)s %(module)s %(process)d ' '%(thread)d %(message)s', }, 'simple': { 'format': '%(levelname)s %(message)s', }, }, 'handlers': { 'sns': { 'level': 'INFO', 'class': 'SNSHandler', 'formatter': 'verbose', 'topic_arn': 'YOUR SNS TOPIC ARN', }, }, 'loggers': { 'YOUR MODULE': { 'handlers': ['sns'], 'level': 'INFO', 'propagate': True, }, }, } </code></pre>