Skip to content

Commit

Permalink
Merge pull request #31 from davidstosik/fix-logs-redirect
Browse files Browse the repository at this point in the history
Try to make pebble's logs redirectable (see #24)
  • Loading branch information
Katharine authored Jun 29, 2016
2 parents 9140bcc + f048337 commit ebf3ccd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pebble_tool/util/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ def __init__(self, pebble, force_colour=None):

def _print(self, packet, message):
colour = self._get_colour(packet)
message_string = message.encode('utf-8')
if colour:
print(colour + message.encode('utf-8') + Style.RESET_ALL)
else:
print(message.encode('utf-8'))
message_string = colour + message_string + Style.RESET_ALL
sys.stdout.write(message_string + '\n')
sys.stdout.flush()

def _get_colour(self, packet):
colour = None
Expand Down

0 comments on commit ebf3ccd

Please sign in to comment.