Logging into aws cloudwatch from python apps
Project description
# python setup.py sdist bdist_wheel
# twine upload dist/*
from awslogger import CloudWatchLogger
import logging
# Replace 'your_aws_key' and 'your_aws_secret' with actual values
# Create an instance of the CloudWatchLogger class
logger = CloudWatchLogger(ACCESS_KEY, SECRET_KEY, REGION_NAME)
logger.set_log_level(logging.ERROR) # Set logging level to INFO
log_group_name = 'my-log-group'
log_stream_name = 'my-log-stream'
logger.create_log_group(log_group_name)
logger.create_log_stream(log_group_name, log_stream_name)
function_name = 'Test function'
# # Log at different levels
logger.put_log_event(log_group_name, log_stream_name, "This is info message.", function_name, log_level=logging.INFO)
logger.put_log_event(log_group_name, log_stream_name, "This is debug message.", function_name, log_level=logging.DEBUG)
logger.put_log_event(log_group_name, log_stream_name, "This is warning message.", function_name, log_level=logging.WARNING)
logger.put_log_event(log_group_name, log_stream_name, "This is critical message.", function_name, log_level=logging.CRITICAL)
logger.put_log_event(log_group_name, log_stream_name, "This is error message.", function_name, log_level=logging.ERROR)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file awscloudwatchlogger-0.2.tar.gz.
File metadata
- Download URL: awscloudwatchlogger-0.2.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
631f83419c7cb8454e1739128206b17296b5ae397bac93716a9d86e255baab29
|
|
| MD5 |
e480d215a730c414311c10eaaf62b515
|
|
| BLAKE2b-256 |
ed388a5146b27a633f9b13351874b1e8afbade5f1c658ec9a345ef3d4cca24a6
|
File details
Details for the file awscloudwatchlogger-0.2-py3-none-any.whl.
File metadata
- Download URL: awscloudwatchlogger-0.2-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15bc461b964c7fcf4bae2c54f35e7118893b09d785303733ef3173c56598f026
|
|
| MD5 |
7d7393873442246d63e87a4cbe8f8193
|
|
| BLAKE2b-256 |
134acd5839dc2fb4eab4c1cee658d4350bc12a6dd94b7f89d3765a6e974c20a0
|