import requests
import time

def log_to_loki(label : str, message : str):
    log_data = {
    "streams": [{
        "stream": {"app": "dongri", "env": label},
        "values": [[str(int(time.time()*1e9)), message]]
        }]
    }
    requests.post("http://1.94.225.168:6611/loki/api/v1/push", json=log_data)



if __name__ == '__main__':
    log_to_loki('test', 'this is a test')