Commits

Jason R. Coombs committed 162de4f

Fixed error in logging setup

  • Participants
  • Parent commits 1f7f71d

Comments (0)

Files changed (2)

File jaraco/net/inet.py

 	PortScanner: scans a range of ports
 	PortListener: listens on a port
 	PortRangeListener: listens on a range of ports
-	
+
 Copyright © 2004-2011 Jason R. Coombs
 """
 
 	def __init__(self):
 		self.ranges = [range(1, 1024)]
 		self.n_threads = 100
-		
+
 	def set_range(self, *r):
 		self.ranges = [range(*r)]
 
 
 class ScanThread(threading.Thread):
 	all_testers = []
-	
+
 	def __init__(self, address):
 		threading.Thread.__init__(self)
 		self.address = address
-		
+
 	def run(self):
 		ScanThread.all_testers.append(self)
 		s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 			self.result = True
 		except socket.error:
 			self.result = False
-		
+
 		self.report()
 
 	def __unicode__(self):
 		}
 		msg_fmt = msg_map[getattr(self, 'result', None)]
 		return msg_fmt.format(**vars(self))
-		
+
 	def report(self):
 		log_method_map = {
 			True: log.info,
 		log.debug('starting tester')
 		tester.start()
 		time.sleep(1/frequency)
-		
+
 class PortListener(threading.Thread):
 	def __init__(self, port):
 		threading.Thread.__init__(self)
 		self.port = port
 		self.setDaemon(1)
 		self.output = sys.stdout
-		
+
 	def run(self):
 		s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 		try:

File jaraco/net/scanner.py

 
 def setup_logger(output_level):
 	outputHandler = logging.StreamHandler(sys.stdout)
-	outputHandler.level = getattr(logging, output_level.upper())
+	outputHandler.level = output_level
 	logging.root.handlers.append(outputHandler)
 	logdir = os.path.join(os.environ['SystemRoot'], 'system32',
 		'logfiles', 'portscan')
 		log.exception('Fatal error occured.  Terminating.')
 
 if __name__ == '__main__':
-	scan()
+	scan()