Skip to content

Commit

Permalink
Make log group name self-descriptive
Browse files Browse the repository at this point in the history
  • Loading branch information
kislyuk committed Dec 10, 2021
1 parent 54f51be commit f78aeb3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ overly broad.
Example: Flask logging with Watchtower
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Use the following configuration to send Flask logs to a CloudWatch Logs stream called "loggable":

.. code-block:: python
import watchtower, flask, logging
logging.basicConfig(level=logging.INFO)
app = flask.Flask("loggable")
handler = watchtower.CloudWatchLogHandler()
handler = watchtower.CloudWatchLogHandler(log_group_name=app.name)
app.logger.addHandler(handler)
logging.getLogger("werkzeug").addHandler(handler)
Expand Down Expand Up @@ -101,7 +103,7 @@ This is an example of Watchtower integration with Django. In your Django project
'watchtower': {
'class': 'watchtower.CloudWatchLogHandler',
'boto3_client': boto3_logs_client,
'log_group_name': 'django-watchtower',
'log_group_name': 'YOUR_DJANGO_PROJECT_NAME',
# Decrease the verbosity level here to send only those logs to watchtower, but still
# see more verbose logs in the console. See the watchtower documentation for other
# parameters that can be set here.
Expand Down

0 comments on commit f78aeb3

Please sign in to comment.