Commit 79aebd63 authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema

Fix logger usage

parent 31d4af94
......@@ -13,8 +13,6 @@ import select
config = ConfigParser()
config.read_file(open(os.path.join(os.path.dirname(__file__), 'telescope.ini')))
logging.basicConfig(level=logging.DEBUG)
_telescope__num_instances = 0
__version__ = "1.1.1"
......@@ -83,6 +81,7 @@ class Telescope:
raise IOError("Could not connect to DT Offset port: " + str(e))
self._event_j2000 = threading.Event()
self.logger = logging.getLogger(__name__)
thread_read_j2000 = threading.Thread(target=self._readj2000, args=(
consoleHost,
config.getint('Console', 'Port_Read_J2000')))
......@@ -191,7 +190,7 @@ class Telescope:
(ra, dec) = setpoint.to_string('hmsdms').split()
cmd = '{:s}\t{:s}\n'.format(ra, dec.strip('+')).encode('UTF-8')
logging.info('J2000 setpoint sent to DT: {}'.format(cmd))
self.logger.info('J2000 setpoint sent to DT: {}'.format(cmd))
self._outsocket.send(cmd)
def setAzEl(self, setpoint):
......@@ -212,7 +211,7 @@ class Telescope:
el = el.to(u.deg).value
cmd = '{:f}\t{:f}\n'.format(az, el).encode('UTF-8')
logging.info('AzEl sent to DT: {}'.format(cmd))
self.logger.info('AzEl sent to DT: {}'.format(cmd))
self._outsocket.send(cmd)
def setOffset(self, offset):
......@@ -236,7 +235,7 @@ class Telescope:
off_el = np.deg2rad(off_el)
cmd = '{:f}\t{:f}\n'.format(off_az, off_el).encode('UTF-8')
logging.info('Offset sent to DT: {}'.format(cmd))
self.logger.info('Offset sent to DT: {}'.format(cmd))
self._offsetsocket.send(cmd)
def getFocusboxPosition(self, waitForUpdate=False):
......@@ -299,7 +298,7 @@ class Telescope:
Wait until distance to the setpoint gets within tolerance
"""
logging.info("Waiting to reach setpoint")
self.logger.info("Waiting to reach setpoint")
distIsSmall = False
while not distIsSmall:
diff = self.getDistance(waitForUpdate=True)
......@@ -309,7 +308,7 @@ class Telescope:
"""
Wait until the telescope reckognizes that it is not at its setpoint
"""
logging.info("Waiting to set setpoint")
self.logger.info("Waiting to set setpoint")
distIsBig = False
while not distIsBig:
dist = self.getDistance(waitForUpdate=True)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment