Skip to content

Commit

Permalink
FilePrinter: Strip to 79 chars
Browse files Browse the repository at this point in the history
  • Loading branch information
sils committed Mar 18, 2015
1 parent e29a92e commit a4c2f2d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions coalib/output/printers/FilePrinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@

class FilePrinter(LogPrinter):
"""
This is a simple printer/logprinter that prints everything to a file. Note that everything will be appended.
This is a simple printer/logprinter that prints everything to a file. Note
that everything will be appended.
"""
def __init__(self, filename, log_level=LOG_LEVEL.WARNING, timestamp_format="%X"):
def __init__(self,
filename,
log_level=LOG_LEVEL.WARNING,
timestamp_format="%X"):
"""
Creates a new FilePrinter. If the directory of the given file doesn't exist or if there's any access problems,
an exception will be thrown.
Creates a new FilePrinter. If the directory of the given file doesn't
exist or if there's any access problems, an exception will be thrown.
:param filename: the name of the file to put the data into (string).
"""
self.file = None
if not isinstance(filename, str):
raise TypeError("filename must be a string.")

LogPrinter.__init__(self, timestamp_format=timestamp_format, log_level=log_level)
LogPrinter.__init__(self,
timestamp_format=timestamp_format,
log_level=log_level)

self.file = open(filename, 'a+')

Expand Down

1 comment on commit a4c2f2d

@Udayan12167
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack.

Please sign in to comment.