Skip to content

Commit 2f99ed7

Browse files
committed
added _log_bump support to loggify, don't show function calls for dict methods
Signed-off-by: Zen <[email protected]>
1 parent f2a630e commit 2f99ed7

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "zenlib"
7-
version = "1.1.1"
7+
version = "1.2.0"
88
authors = [
99
{ name="Desultory", email="[email protected]" },
1010
]

src/zenlib/logging/loggify.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = "desultory"
2-
__version__ = "1.1.0"
2+
__version__ = "1.2.0"
33

44
from zenlib.logging import ColorLognameFormatter
55

@@ -15,7 +15,7 @@ class ClassWrapper(cls):
1515
def __init__(self, *args, **kwargs):
1616
parent_logger = kwargs.pop('logger') if isinstance(kwargs.get('logger'), Logger) else getLogger()
1717
self.logger = parent_logger.getChild(self.__class__.__name__)
18-
self.logger.setLevel(self.logger.parent.level)
18+
self.logger.setLevel(self.logger.parent.level + kwargs.pop('_log_bump', 0))
1919

2020
def has_handler(logger):
2121
parent = logger
@@ -33,6 +33,7 @@ def has_handler(logger):
3333

3434
if kwargs.pop('_log_init', True) is True:
3535
self.logger.info("Intializing class: %s" % cls.__name__)
36+
self.logger.debug("Log level: %s" % self.logger.level)
3637

3738
if args:
3839
self.logger.debug("Args: %s" % repr(args))
@@ -53,7 +54,8 @@ def __getattribute__(self, name):
5354
Does not log functions starting with _ to debug level
5455
"""
5556
attr = super().__getattribute__(name)
56-
if callable(attr) and not name.startswith('__'):
57+
# Ignore builtins
58+
if callable(attr) and not name.startswith('__') and name not in ['get', 'set', 'items', 'keys', 'values']:
5759
def wrapper(*args, **kwargs):
5860
if not name.startswith('_'):
5961
self.logger.debug("Calling function: %s" % name)

0 commit comments

Comments
 (0)