mirror of
https://github.com/DictXiong/dotfiles.git
synced 2025-07-01 21:00:29 +08:00
log: use hostname directly
This commit is contained in:
parent
dc92cd249b
commit
8c289c8c3c
@ -33,13 +33,6 @@ def get_uuid() -> str:
|
|||||||
return str(uuid.uuid5(namespace, get_uuid_raw()))
|
return str(uuid.uuid5(namespace, get_uuid_raw()))
|
||||||
|
|
||||||
|
|
||||||
def get_hostname() -> str:
|
|
||||||
ans = socket.gethostname()
|
|
||||||
if '-' not in ans:
|
|
||||||
ans += "-ibd-ink"
|
|
||||||
return ans
|
|
||||||
|
|
||||||
|
|
||||||
def post_log(url:str, hostname:str, uuid:str, content:str):
|
def post_log(url:str, hostname:str, uuid:str, content:str):
|
||||||
ans = requests.post(url, params={"hostname": hostname, "uuid": uuid}, data=content)
|
ans = requests.post(url, params={"hostname": hostname, "uuid": uuid}, data=content)
|
||||||
return ans
|
return ans
|
||||||
@ -52,7 +45,7 @@ if __name__ == "__main__":
|
|||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
url = args.url
|
url = args.url
|
||||||
content = args.content
|
content = args.content
|
||||||
hostname = get_hostname()
|
hostname = socket.gethostname()
|
||||||
uuid = get_uuid()
|
uuid = get_uuid()
|
||||||
content=content.strip()
|
content=content.strip()
|
||||||
if not content:
|
if not content:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user