Skip to content

Commit

Permalink
Merge pull request #21 from apel/more_code_health
Browse files Browse the repository at this point in the history
Correct arguments to logging calls
  • Loading branch information
tofu-rocketry committed Nov 24, 2014
2 parents 0b1d1c7 + 8ffbff0 commit 3901cc8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions bin/receiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ def get_dns(dn_file):
elif line.strip().startswith('/'):
dns.append(line.strip())
else:
log.warn('DN in incorrect format: %s' % line)
log.warn('DN in incorrect format: %s', line)
finally:
if f is not None:
f.close()
# If no valid DNs, SSM cannot receive any messages.
if len(dns) == 0:
raise Ssm2Exception('No valid DNs found in %s. SSM will not start' % dn_file)
log.debug('%s DNs found.' % len(dns))

log.debug('%s DNs found.', len(dns))
return dns


Expand Down Expand Up @@ -108,8 +108,8 @@ def main():
log = logging.getLogger('ssmreceive')

log.info(LOG_BREAK)
log.info('Starting receiving SSM version %s.%s.%s.' % __version__)
log.info('Starting receiving SSM version %s.%s.%s.', *__version__)

# If we can't get a broker to connect to, we have to give up.
try:
bg = StompBrokerGetter(cp.get('broker','bdii'))
Expand All @@ -131,7 +131,7 @@ def main():
log.info(LOG_BREAK)
sys.exit(1)
except ldap.SERVER_DOWN, e:
log.error('Could not connect to LDAP server: %s' % e)
log.error('Could not connect to LDAP server: %s', e)
log.error('System will exit.')
log.info(LOG_BREAK)
sys.exit(1)
Expand Down Expand Up @@ -165,7 +165,7 @@ def main():
ssm.set_dns(dns)

except Exception, e:
log.fatal('Failed to initialise SSM: %s' % e)
log.fatal('Failed to initialise SSM: %s', e)
log.info(LOG_BREAK)
sys.exit(1)

Expand Down Expand Up @@ -206,7 +206,7 @@ def main():
dc.close()
except Exception, e:
log.error('Unexpected exception: ' + str(e))
log.error('Exception type: %s' % e.__class__)
log.error('Exception type: %s', e.__class__)
log.error('The SSM will exit.')
ssm.shutdown()
dc.close()
Expand Down

0 comments on commit 3901cc8

Please sign in to comment.