send line message notification, support aws lambda
Project description
PynamoLogger
log information into a dynamodb, with dax support
Install
pip install pynamologger
view Documentation
Usage
create a dynamodb table
indexKey
- appName
rangeKey
- timestamp
Sam template
put this in your template.yaml file under properties section
make sure that the table name is the same in Meta declaration
YourLogTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: appName
AttributeType: S
- AttributeName: timestamp
AttributeType: N
BillingMode: PAY_PER_REQUEST
TableName: <put your table name here>
KeySchema:
- AttributeName: appName
KeyType: HASH
- AttributeName: timestamp
KeyType: RANGE
create using pynamodb api
Logger.create_table()
class meta definition
from pynamoLogger.logger import PynamoLogger
class Logger(PynamoLogger):
class Meta:
table_name = 'member-database-log-dev-manual' # put your table name
region = 'ap-southeast-1' #put your region name
billing_mode = 'PAY_PER_REQUEST'
# Logger.create_table()
Logger.log(appName = 'test', message = "this is crazy", responseObject = {'response': 'null response'})
{'logId': 1603075789.054751,
'saveResult': {'ConsumedCapacity': {'CapacityUnits': 1.0,
'TableName': 'member-database-log-dev-manual'}}}
Logger.checkLog(appName = 'test', logId = '1603074235.103042')
[{'appName': None,
'timestamp': 1603074235.103042,
'logMessage': 'this is crazy',
'requestObject': {'noValue': 'noValue'},
'responseObject': {'response': 'null response'}}]
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
pynamoLogger-0.0.2.tar.gz
(10.0 kB
view details)
Built Distribution
File details
Details for the file pynamoLogger-0.0.2.tar.gz
.
File metadata
- Download URL: pynamoLogger-0.0.2.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20201009 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0be1adbb1c49a15ff158e7e7d6cd7260ba40c47788cbbcb3955122c1c47eccb |
|
MD5 | b4af69b682fd687d237189bf68362907 |
|
BLAKE2b-256 | 34459e0e6076414f6716621b2d5fab363109b7a98667f7971b8a637584e8d57e |
File details
Details for the file pynamoLogger-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: pynamoLogger-0.0.2-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20201009 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5306d8f6c34af42e48eb940594a8d564cd7e6acd32e6921f965e4f4087274924 |
|
MD5 | e72c05dc1bb89b3063e471812a747462 |
|
BLAKE2b-256 | c66bbafbcf0d43473a6f9dca7201f879c71dd8a644c60bbbc6dfed38e5601589 |