mirror of
https://github.com/Wojtek242/pylg.git
synced 2024-11-21 15:35:24 +01:00
Release 1.2.2
This commit is contained in:
parent
4c8bfc2763
commit
6395ddd821
@ -1,6 +1,11 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
1.2.2
|
||||
-----
|
||||
|
||||
- Modified message wrapping code.
|
||||
|
||||
1.2.1
|
||||
-----
|
||||
|
||||
|
81
pylg/pylg.py
81
pylg/pylg.py
@ -478,54 +478,55 @@ def trace(message, function=None):
|
||||
# -----------------------------------------------------------------
|
||||
wrapped = textwrap.wrap(message, MESSAGE_WIDTH)
|
||||
|
||||
if wrapped:
|
||||
if MESSAGE_WRAP:
|
||||
if not wrapped:
|
||||
wrapped = [""]
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# Print the first line. It gets special treatment
|
||||
# as it doesn't need whitespace in front of it.
|
||||
# ---------------------------------------------------------
|
||||
msg += wrapped[0]
|
||||
if MESSAGE_WRAP:
|
||||
|
||||
# -------------------------------------------------------------
|
||||
# Print the first line. It gets special treatment as
|
||||
# it doesn't need whitespace in front of it.
|
||||
# -------------------------------------------------------------
|
||||
msg += wrapped[0]
|
||||
|
||||
# -------------------------------------------------------------
|
||||
# Print the remaining lines. Append whitespace to
|
||||
# align it with the first line.
|
||||
# -------------------------------------------------------------
|
||||
for line in wrapped[1:]:
|
||||
msg += '\n' + '{:{w}}'.format('', w=premsglen) + line
|
||||
|
||||
else:
|
||||
# -------------------------------------------------------------
|
||||
# The message is not being wrapped.
|
||||
# -------------------------------------------------------------
|
||||
|
||||
if MESSAGE_MARK_TRUNCATION and wrapped[1:]:
|
||||
# ---------------------------------------------------------
|
||||
# Print the remaining lines. Append whitespace to
|
||||
# align it with the first line.
|
||||
# We want to mark truncated lines so we need to
|
||||
# determine if the line is being truncated. If it
|
||||
# is we replace the last character with '\'.
|
||||
# ---------------------------------------------------------
|
||||
for line in wrapped[1:]:
|
||||
msg += '\n' + '{:{w}}'.format('', w=premsglen) + line
|
||||
|
||||
if MESSAGE_WIDTH > 1:
|
||||
wrapped = textwrap.wrap(wrapped[0],
|
||||
MESSAGE_WIDTH - 1)
|
||||
assert wrapped
|
||||
|
||||
msg += ('{m:{w}}'.format(m=wrapped[0],
|
||||
w=MESSAGE_WIDTH - 1) +
|
||||
'\\')
|
||||
|
||||
else:
|
||||
assert MESSAGE_WIDTH == 1
|
||||
msg += '\\'
|
||||
|
||||
else:
|
||||
# ---------------------------------------------------------
|
||||
# The message is not being wrapped.
|
||||
# Either the message is not being truncated or
|
||||
# MESSAGE_MARK_TRUNCATION is False.
|
||||
# ---------------------------------------------------------
|
||||
|
||||
if MESSAGE_MARK_TRUNCATION and wrapped[1:]:
|
||||
# -----------------------------------------------------
|
||||
# We want to mark truncated lines so we need
|
||||
# to determine if the line is being
|
||||
# truncated. If it is we replace the last
|
||||
# character with '\'.
|
||||
# -----------------------------------------------------
|
||||
|
||||
if MESSAGE_WIDTH > 1:
|
||||
wrapped = textwrap.wrap(wrapped[0],
|
||||
MESSAGE_WIDTH - 1)
|
||||
assert wrapped
|
||||
|
||||
msg += ('{m:{w}}'.format(m=wrapped[0],
|
||||
w=MESSAGE_WIDTH - 1) +
|
||||
'\\')
|
||||
|
||||
else:
|
||||
assert MESSAGE_WIDTH == 1
|
||||
msg += '\\'
|
||||
|
||||
else:
|
||||
# -----------------------------------------------------
|
||||
# Either the message is not being truncated or
|
||||
# MESSAGE_MARK_TRUNCATION is False.
|
||||
# -----------------------------------------------------
|
||||
msg += wrapped[0]
|
||||
msg += wrapped[0]
|
||||
|
||||
else:
|
||||
# -----------------------------------------------------------------
|
||||
|
4
setup.py
4
setup.py
@ -9,7 +9,7 @@ with open(path.join(pwd, 'README.rst'), encoding='utf-8') as f:
|
||||
|
||||
setup(
|
||||
name='PyLg',
|
||||
version='1.2.1',
|
||||
version='1.2.2',
|
||||
description='Python module to facilitate and automate the process of writing runtime logs.',
|
||||
long_description=long_description,
|
||||
url='https://gitlab.wojciechkozlowski.eu/wojtek/PyLg',
|
||||
@ -17,7 +17,7 @@ setup(
|
||||
author='Wojciech Kozlowski',
|
||||
author_email='wojciech.kozlowski@vivaldi.net',
|
||||
classifiers=[
|
||||
'Development Status :: 3 - Alpha',
|
||||
'Development Status :: 4 - Beta',
|
||||
'Intended Audience :: Developers',
|
||||
'Topic :: Software Development :: Debuggers',
|
||||
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
|
||||
|
Loading…
Reference in New Issue
Block a user