Longleding Operation Log Service SDK
Project description
Longleding Operation Log Service SDK
Supported Python Versions
Python >= 3.6
Installation
longleding-operation-log-service-sdk is available for Linux, macOS, and Windows.
$ pip install longleding-operation-log-service-sdk
Basic Usage
# -*- coding: utf-8 -*-
from datetime import datetime
import operation_log_service_sdk
operation_log_service_endpoint = "localhost:80"
source_name = "demo"
operation_log_service_sdk.init_service(endpoint=operation_log_service_endpoint, source=source_name)
def put_log():
log = {
"time": datetime.now(),
"topic": "tpc",
"tags": {"tg1": "v1", "tg2": "v2"},
"content": "say something."
}
operation_log_service_sdk.log(**log)
def get_logs():
end_time = datetime.now()
start_time = datetime.strptime(("%d-%02d-%02d 00:00:00" % (end_time.year, end_time.month, end_time.day)), "%Y-%m-%d %H:%M:%S")
request = {
"start_time": start_time,
"end_time": end_time,
"offset": 0,
"limit": 0,
"reverse": False,
"topic_in": ["tpc", "other"],
"source_in": ["demo", "other"],
"tag_contains": {
"tg1": ["v1", "v8"],
"tg2": [],
},
}
print("request: " + str(request))
print("\n================================\n")
resp = operation_log_service_sdk.get_operation_logs(**request)
for v in resp:
print(v)
if __name__ == '__main__':
put_log()
get_logs()
Project details
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
Close
Hashes for longleding-operation-log-service-sdk-0.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83958c1bea2e4ba3e488ca65fe5a7961b8f308654a8a109452faca85dfac6274 |
|
MD5 | 3dd58c66d5a55e57d47dd61e6042c528 |
|
BLAKE2b-256 | b0f0780239d43849966ff4c239deb4a0f04bc0b0dea4f3e976af1bdbaf5bcb80 |
Close
Hashes for longleding_operation_log_service_sdk-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | accb5818cfc16cc1f0f0370aca020d5a6394b4ea306e6359d944fa4cc391d6cc |
|
MD5 | 921727a6412faa9763a8767f4d87b72a |
|
BLAKE2b-256 | 6cc10db726f2fe7b557e85c340e86eda00de242c3c6e0bfc25fea73e71f16c95 |