Permalink
Browse files

log level only if __main__, testbroker simpler

  • Loading branch information...
1 parent 6d6be7d commit 67e38be51be212e8e819e418149f9d515ddd7fb0 @rep committed Aug 8, 2012
Showing with 6 additions and 8 deletions.
  1. +1 −1 broker/feedbroker.py
  2. +5 −7 broker/testbroker.py
View
@@ -8,7 +8,6 @@
import random
import logging
-logging.basicConfig(level=logging.INFO)
from evnet import loop, unloop, listenplain, EventGen
from evnet.mongodb import MongoConn
@@ -287,5 +286,6 @@ def main():
return 0
if __name__ == '__main__':
+ logging.basicConfig(level=logging.INFO)
sys.exit(main())
View
@@ -1,6 +1,7 @@
import sys
import feedbroker
from feedbroker import *
+logging.basicConfig(level=logging.DEBUG)
FeedConnOrig = FeedConn
@@ -17,13 +18,10 @@ def auth(self, ident, hash):
self.checkauth([{'identifier': str(ident), 'secret': 'secretsecret'},], hash)
def checkauth(self, r, hash):
- if len(r) > 0:
- akobj = r[0]
- akhash = hashlib.sha1('{0}{1}'.format(self.rand, akobj['secret'])).digest()
- self.idents.add(akobj['identifier'])
- logging.info('Auth success by {0}.'.format(akobj['identifier']))
- else:
- self.error('authfail.')
+ akobj = r[0]
+ akhash = hashlib.sha1('{0}{1}'.format(self.rand, akobj['secret'])).digest()
+ self.idents.add(akobj['identifier'])
+ logging.info('Auth success by {0}, {1}.'.format(akobj['identifier'], self.conn.addr))
self.io_in(b'')

0 comments on commit 67e38be

Please sign in to comment.