Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 0b96f10c

Přidáno uživatelem Pultak před více než 2 roky(ů)

re #9360 Added logging system -> log config, logging messages

Zobrazit rozdíly:

client/usb_detector/detector.py
11 11

  
12 12

  
13 13
def register_listener(callback, connected: bool = True):
14
    logging.info(f'Registering callback: {callback}.')
15

  
14 16
    if connected is True:
15 17
        _listeners_connected.append(callback)
16 18
    else:
......
24 26

  
25 27

  
26 28
def _store_connected_devices(devices: list):
29
    logging.debug('storing newly connected devices')
27 30
    with open(connected_devices_filename, "w") as file:
28 31
        json.dump(devices, file)
29 32

  
30 33

  
31 34
def _load_last_connected_devices() -> list:
35
    logging.debug('loading last connected devices')
32 36
    try:
33 37
        with open(connected_devices_filename, "r") as file:
34 38
            return json.loads(file.read())
35 39
    except IOError:
40
        logging.error('loading of last connected devices failed')
36 41
        return []
37 42

  
38 43

  

Také k dispozici: Unified diff