Skip to content

Commit

Permalink
Bug fixes and improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
MPCodeWriter21 committed Dec 1, 2022
1 parent 1addc2d commit d5a0eea
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGES-LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Help this project by [Donation](DONATE.md)
Changes log
-----------

### 2.4.1

Bug fixes and improvements.

### 2.4.0

+ Made it more compatible with multi-threading.
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@ python setup.py install
Changes
-------

### 2.4.0
### 2.4.1

+ Made it more compatible with multi-threading.
+ Fixed some bugs.
Bug fixes and improvements.

[Full Changes Log](https://github.com/MPCodeWriter21/log21/blob/master/CHANGES-LOG.md)

Expand Down
9 changes: 6 additions & 3 deletions log21/PPrint.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class PrettyPrinter(_PrettyPrinter):
}

def __init__(self, indent=1, width=80, depth=None, stream=None, signs_colors: _Dict[str, str] = None, *,
compact=False, **kwargs):
compact=False, sort_dicts=True, underscore_numbers=False, **kwargs):
super().__init__(indent=indent, width=width, depth=depth, stream=stream, compact=compact, **kwargs)
self._depth = depth
self._indent_per_level = indent
Expand All @@ -86,6 +86,8 @@ def __init__(self, indent=1, width=80, depth=None, stream=None, signs_colors: _D
else:
self._stream = _sys.stdout
self._compact = bool(compact)
self._sort_dicts = sort_dicts
self._underscore_numbers = underscore_numbers
if signs_colors:
for sign, color in signs_colors.items():
self.signs_colors[sign.lower()] = _gc(color)
Expand Down Expand Up @@ -560,7 +562,8 @@ def _pprint_user_string(self, obj, stream, indent, allowance, context, level):
_dispatch[_collections.UserString.__repr__] = _pprint_user_string


def pformat(obj, indent=1, width=80, depth=None, signs_colors: _Dict[str, str] = None, *, compact=False, **kwargs):
def pformat(obj, indent=1, width=80, depth=None, signs_colors: _Dict[str, str] = None, *, compact=False,
sort_dicts=True, underscore_numbers=False, **kwargs):
"""Format a Python object into a pretty-printed representation."""
return PrettyPrinter(indent=indent, width=width, depth=depth, compact=compact, signs_colors=signs_colors,
**kwargs).pformat(obj)
sort_dicts=True, underscore_numbers=False, **kwargs).pformat(obj)
10 changes: 5 additions & 5 deletions log21/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from log21.Formatters import ColorizingFormatter, DecolorizingFormatter
from log21.Colors import Colors, get_color, get_colors, ansi_escape, get_color_name, closest_color

__version__ = "2.4.0"
__version__ = "2.4.1"
__author__ = "CodeWriter21 (Mehrad Pooryoussof)"
__github__ = "Https://GitHub.com/MPCodeWriter21/log21"
__all__ = ['ColorizingStreamHandler', 'DecolorizingFileHandler', 'ColorizingFormatter', 'DecolorizingFormatter',
Expand Down Expand Up @@ -235,11 +235,11 @@ def getpass(*msg, args: tuple = (), end='', **kwargs):
return logger.getpass(*msg, args=args, end=end, **kwargs)


def pprint(obj, indent=1, width=80, depth=None, signs_colors: _Dict[str, str] = None, *, compact=False, end='\033[0m\n',
**kwargs):
def pprint(obj, indent=1, width=80, depth=None, signs_colors: _Dict[str, str] = None, *, sort_dicts=True,
underscore_numbers=False, compact=False, end='\033[0m\n', **kwargs):
logger = get_logger('log21.pprint', level=DEBUG, show_time=False, show_level=False)
logger.print(pformat(obj=obj, indent=indent, width=width, depth=depth, signs_colors=signs_colors, compact=compact),
end=end, **kwargs)
logger.print(pformat(obj=obj, indent=indent, width=width, depth=depth, signs_colors=signs_colors, compact=compact,
sort_dicts=sort_dicts, underscore_numbers=underscore_numbers), end=end, **kwargs)


pretty_print = pprint
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
long_description = file.read()

DESCRIPTION = 'A simple logging package that helps you log colorized messages in Windows console.'
VERSION = '2.4.0'
VERSION = '2.4.1'

setup(
name='log21',
Expand Down

0 comments on commit d5a0eea

Please sign in to comment.