Skip to content

Commit

Permalink
Merge pull request #3 from sot/always_make_rundat
Browse files Browse the repository at this point in the history
Always write run.dat
  • Loading branch information
jeanconn committed Aug 18, 2015
2 parents e1734d8 + c68683c commit 9775893
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions psmc_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,22 +471,30 @@ def emit(self, record):
rootlogger = logging.getLogger()
rootlogger.addHandler(NullHandler())

logger = logging.getLogger('psmc_check')
logger.setLevel(logging.DEBUG)

# Get loglevel for console output
loglevel = {0: logging.CRITICAL,
1: logging.INFO,
2: logging.DEBUG}.get(verbose, logging.INFO)

logger = logging.getLogger('psmc_check')
logger.setLevel(loglevel)

formatter = logging.Formatter('%(message)s')

console = logging.StreamHandler()
console.setFormatter(formatter)
console.setLevel(loglevel)
logger.addHandler(console)

filehandler = logging.FileHandler(
filename=os.path.join(outdir, 'run.dat'), mode='w')
filehandler.setFormatter(formatter)
# Set the file loglevel to be at least INFO,
# but override to DEBUG if that is requested at the
# command line
filehandler.setLevel(logging.INFO)
if loglevel == logging.DEBUG:
filehandler.setLevel(logging.DEBUG)
logger.addHandler(filehandler)


Expand Down

0 comments on commit 9775893

Please sign in to comment.