~mrol-dev/mrol/trunk

« back to all changes in this revision

Viewing changes to mrol_mapping/log.py

  • Committer: Vikas Dhiman
  • Date: 2013-03-11 17:33:54 UTC
  • Revision ID: vikasdhi@buffalo.edu-20130311173354-cmwv3q7e8j0hnlf4
Change logger to print logger

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import logging
 
2
logging.basicConfig(filename='/tmp/mrol_logger.log')
 
3
class PrintLogger(object):
 
4
    def debug(self, msg):
 
5
        print(msg)
 
6
    def info(self, msg):
 
7
        print(msg)
 
8
    def setLevel(self, level):
 
9
        pass
2
10
def getLogger(name):
3
11
    logger = logging.getLogger(name)
4
12
    # create console handler with a higher log level
8
16
    formatter = logging.Formatter('%(name)s - %(message)s')
9
17
    ch.setFormatter(formatter)
10
18
    logger.addHandler(ch)
11
 
    return logger
 
19
    #return logger
 
20
    return PrintLogger()