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
log_service_endpoint = "localhost:80"
source_name = "demo"
operation_log_service.init_service(endpoint=log_service_endpoint, src=source_name)
def put_log():
log = {
"time": datetime.now(),
"topic": "tpc",
"tags": {"tg1": "v1", "tg2": "v2"},
"content": "say something."
}
operation_log_service.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.get_operation_logs(**request)
print(resp.total)
for v in resp.logs:
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
File details
Details for the file longleding-operation-log-service-sdk-0.3.0.tar.gz
.
File metadata
- Download URL: longleding-operation-log-service-sdk-0.3.0.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f64115f46fa1d9cca1628b6c8ce1940e413fd66316c5a1be88b21f26aaf3bcb |
|
MD5 | 1e308ace31b15dc5cb0e35d45e8ba50b |
|
BLAKE2b-256 | f04ef4149833695dff0eac82fc9cea23782a1efc293fa7851de45e8c22a377c7 |
File details
Details for the file longleding_operation_log_service_sdk-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: longleding_operation_log_service_sdk-0.3.0-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f4f6001060d9ac9c4864e2f71719eb9d9fef48bb768677773a08a6bd0a71d51 |
|
MD5 | b92318684cb5feb6a79a96ecac632bfc |
|
BLAKE2b-256 | 2a07dceb867ca5647dfd5d23879553b542fbc7c8e4e680190b094976af886ed0 |