Improve logging a little
This commit is contained in:
parent
c72727b9a0
commit
7c8642bfbb
@ -1,3 +1,4 @@
|
|||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
@ -8,6 +9,10 @@ from .consts import DEFAULT_USERNAME
|
|||||||
from .misc import create_dir
|
from .misc import create_dir
|
||||||
|
|
||||||
|
|
||||||
|
logging.basicConfig(format="%(asctime)s %(message)s",
|
||||||
|
level=logging.INFO)
|
||||||
|
|
||||||
|
|
||||||
class SeafileClient:
|
class SeafileClient:
|
||||||
def __init__(self, host: str, port: int, user: str, passwd: str):
|
def __init__(self, host: str, port: int, user: str, passwd: str):
|
||||||
self.url = f"https://{host}:{port}"
|
self.url = f"https://{host}:{port}"
|
||||||
@ -60,7 +65,8 @@ class SeafileClient:
|
|||||||
if line.startswith('#') or not line.strip():
|
if line.startswith('#') or not line.strip():
|
||||||
continue
|
continue
|
||||||
lib, status = line.split(sep='\t', maxsplit=1)
|
lib, status = line.split(sep='\t', maxsplit=1)
|
||||||
status = status.replace('\t', ' ')
|
lib = lib.strip()
|
||||||
|
status = " ".join(status.split())
|
||||||
statuses[lib] = status
|
statuses[lib] = status
|
||||||
return statuses
|
return statuses
|
||||||
|
|
||||||
@ -71,7 +77,7 @@ class SeafileClient:
|
|||||||
cur_status = self.get_status()
|
cur_status = self.get_status()
|
||||||
for folder, state in cur_status.items():
|
for folder, state in cur_status.items():
|
||||||
if state != prev_status.get(folder):
|
if state != prev_status.get(folder):
|
||||||
print(f"Library {folder}:\t{state}")
|
logging.info(f"Library {folder}:\t{state}")
|
||||||
prev_status[folder] = cur_status[folder]
|
prev_status[folder] = cur_status[folder]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user