Release 1.2.2

This commit is contained in:
Wojciech Kozlowski 2017-03-14 22:32:19 +00:00
parent 4c8bfc2763
commit 6395ddd821
3 changed files with 48 additions and 42 deletions

View File

@ -1,6 +1,11 @@
Changelog Changelog
========= =========
1.2.2
-----
- Modified message wrapping code.
1.2.1 1.2.1
----- -----

View File

@ -478,34 +478,35 @@ def trace(message, function=None):
# ----------------------------------------------------------------- # -----------------------------------------------------------------
wrapped = textwrap.wrap(message, MESSAGE_WIDTH) wrapped = textwrap.wrap(message, MESSAGE_WIDTH)
if wrapped: if not wrapped:
wrapped = [""]
if MESSAGE_WRAP: if MESSAGE_WRAP:
# --------------------------------------------------------- # -------------------------------------------------------------
# Print the first line. It gets special treatment # Print the first line. It gets special treatment as
# as it doesn't need whitespace in front of it. # it doesn't need whitespace in front of it.
# --------------------------------------------------------- # -------------------------------------------------------------
msg += wrapped[0] msg += wrapped[0]
# --------------------------------------------------------- # -------------------------------------------------------------
# Print the remaining lines. Append whitespace to # Print the remaining lines. Append whitespace to
# align it with the first line. # align it with the first line.
# --------------------------------------------------------- # -------------------------------------------------------------
for line in wrapped[1:]: for line in wrapped[1:]:
msg += '\n' + '{:{w}}'.format('', w=premsglen) + line msg += '\n' + '{:{w}}'.format('', w=premsglen) + line
else: else:
# --------------------------------------------------------- # -------------------------------------------------------------
# The message is not being wrapped. # The message is not being wrapped.
# --------------------------------------------------------- # -------------------------------------------------------------
if MESSAGE_MARK_TRUNCATION and wrapped[1:]: if MESSAGE_MARK_TRUNCATION and wrapped[1:]:
# ----------------------------------------------------- # ---------------------------------------------------------
# We want to mark truncated lines so we need # We want to mark truncated lines so we need to
# to determine if the line is being # determine if the line is being truncated. If it
# truncated. If it is we replace the last # is we replace the last character with '\'.
# character with '\'. # ---------------------------------------------------------
# -----------------------------------------------------
if MESSAGE_WIDTH > 1: if MESSAGE_WIDTH > 1:
wrapped = textwrap.wrap(wrapped[0], wrapped = textwrap.wrap(wrapped[0],
@ -521,10 +522,10 @@ def trace(message, function=None):
msg += '\\' msg += '\\'
else: else:
# ----------------------------------------------------- # ---------------------------------------------------------
# Either the message is not being truncated or # Either the message is not being truncated or
# MESSAGE_MARK_TRUNCATION is False. # MESSAGE_MARK_TRUNCATION is False.
# ----------------------------------------------------- # ---------------------------------------------------------
msg += wrapped[0] msg += wrapped[0]
else: else:

View File

@ -9,7 +9,7 @@ with open(path.join(pwd, 'README.rst'), encoding='utf-8') as f:
setup( setup(
name='PyLg', name='PyLg',
version='1.2.1', version='1.2.2',
description='Python module to facilitate and automate the process of writing runtime logs.', description='Python module to facilitate and automate the process of writing runtime logs.',
long_description=long_description, long_description=long_description,
url='https://gitlab.wojciechkozlowski.eu/wojtek/PyLg', url='https://gitlab.wojciechkozlowski.eu/wojtek/PyLg',
@ -17,7 +17,7 @@ setup(
author='Wojciech Kozlowski', author='Wojciech Kozlowski',
author_email='wojciech.kozlowski@vivaldi.net', author_email='wojciech.kozlowski@vivaldi.net',
classifiers=[ classifiers=[
'Development Status :: 3 - Alpha', 'Development Status :: 4 - Beta',
'Intended Audience :: Developers', 'Intended Audience :: Developers',
'Topic :: Software Development :: Debuggers', 'Topic :: Software Development :: Debuggers',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',