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.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8cbb36049691b77231af22a13e5f0b05fb1d2cf06074810f623e61814032cb1 |
|
MD5 | 72aca560740c31535f288c1ea27515cf |
|
BLAKE2b-256 | 36f4c1fd7152db37e09851ec4bff398d4af123b15c924a17bbc1f7f69f43eade |
Close
Hashes for longleding_operation_log_service_sdk-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f1bab7a717629e21a9de5b3cbaff3c992ff7a325d1466705cbb31b82c17cbf9 |
|
MD5 | 170ea319d3d30780d5c97b02c2e64686 |
|
BLAKE2b-256 | 4301d5bef0b0149363fecf2c675c32ca8782eae0d52207bd6977843e572631fb |