Skip to content

Commit

Permalink
Only enable logging when connected to interactive terminal (issue #53)
Browse files Browse the repository at this point in the history
  • Loading branch information
xolox committed Nov 1, 2015
1 parent 464d006 commit 65f5455
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions misc/notes/search-notes.py
Expand Up @@ -107,9 +107,9 @@ def __init__(self):
def init_logging(self):
"""Initialize the logging subsystem."""
self.logger = logging.getLogger('search-notes')
self.logger.addHandler(logging.StreamHandler(sys.stderr))
if os.isatty(0):
self.logger.setLevel(logging.INFO)
self.logger.setLevel(logging.INFO)
if all(map(os.isatty, (0, 1, 2))):
self.logger.addHandler(logging.StreamHandler(sys.stderr))

def parse_args(self):
"""Parse the command line arguments."""
Expand Down

0 comments on commit 65f5455

Please sign in to comment.