mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-09 03:42:16 +03:00
config.py: Log exception type from darwin getint()
* Also sets up `logger`.
This commit is contained in:
parent
fcb7685d71
commit
854c79c070
@ -5,6 +5,7 @@ On Windows this uses the Registry to store values in a flat manner.
|
|||||||
Linux uses a file, but for commonality it's still a flat data structure.
|
Linux uses a file, but for commonality it's still a flat data structure.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import logging
|
||||||
import numbers
|
import numbers
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
import warnings
|
||||||
@ -30,6 +31,11 @@ copyright = u'© 2015-2019 Jonathan Harris, 2020-2021 EDCD'
|
|||||||
update_feed = 'https://raw.githubusercontent.com/EDCD/EDMarketConnector/releases/edmarketconnector.xml'
|
update_feed = 'https://raw.githubusercontent.com/EDCD/EDMarketConnector/releases/edmarketconnector.xml'
|
||||||
update_interval = 8*60*60
|
update_interval = 8*60*60
|
||||||
|
|
||||||
|
if getenv("EDMC_NO_UI"):
|
||||||
|
logger = logging.getLogger(appcmdname)
|
||||||
|
|
||||||
|
else:
|
||||||
|
logger = logging.getLogger(appname)
|
||||||
|
|
||||||
if platform == 'darwin':
|
if platform == 'darwin':
|
||||||
from Foundation import (
|
from Foundation import (
|
||||||
@ -184,7 +190,8 @@ class Config(object):
|
|||||||
"""Look up an integer configuraiton value."""
|
"""Look up an integer configuraiton value."""
|
||||||
try:
|
try:
|
||||||
return int(self.settings.get(key, 0)) # should already be int, but check by casting
|
return int(self.settings.get(key, 0)) # should already be int, but check by casting
|
||||||
except:
|
except Exception as e:
|
||||||
|
logger.debug('The exception type is ...', exc_info=e)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def set(self, key: str, val: Union[int, str]) -> None:
|
def set(self, key: str, val: Union[int, str]) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user