mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-11 10:00:58 +00:00
textwrap utility method for logger
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@2082 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
d6603dd345
commit
76751c04af
1 changed files with 10 additions and 0 deletions
|
|
@ -21,6 +21,8 @@ import os
|
|||
import os.path
|
||||
import datetime
|
||||
|
||||
import linkcheck.strformat
|
||||
|
||||
_ = lambda x: x
|
||||
Fields = dict(
|
||||
realurl=_("Real URL"),
|
||||
|
|
@ -96,6 +98,14 @@ class Logger (object):
|
|||
"""Print given comment and a newline."""
|
||||
self.writeln(s=s, **args)
|
||||
|
||||
def wrap (self, lines, width):
|
||||
"""Return wrapped version of given lines."""
|
||||
sep = os.linesep+os.linesep
|
||||
text = sep.join(lines)
|
||||
return linkcheck.strformat.wrap(text, width,
|
||||
subsequent_indent=" "*self.max_indent,
|
||||
initial_indent=" "*self.max_indent).lstrip()
|
||||
|
||||
def write (self, s, **args):
|
||||
"""Write string to output descriptor."""
|
||||
if self.fd is None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue