Skip to content

Commit

Permalink
Merge pull request #6: Proper funcName settings
Browse files Browse the repository at this point in the history
  • Loading branch information
xolox committed Mar 7, 2017
2 parents 2a78df2 + 8310b31 commit 8d2fe97
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
15 changes: 9 additions & 6 deletions verboselogs/__init__.py
Expand Up @@ -125,14 +125,17 @@ def __init__(self, *args, **kw):
logging.Logger.__init__(self, *args, **kw)
self.parent = logging.getLogger()

def notice(self, *args, **kw):
def notice(self, msg, *args, **kw):
"""Log a message with level :data:`NOTICE`. The arguments are interpreted as for :func:`logging.debug()`."""
self.log(NOTICE, *args, **kw)
if self.isEnabledFor(NOTICE):
self._log(NOTICE, msg, args, **kw)

def verbose(self, *args, **kw):
def verbose(self, msg, *args, **kw):
"""Log a message with level :data:`VERBOSE`. The arguments are interpreted as for :func:`logging.debug()`."""
self.log(VERBOSE, *args, **kw)
if self.isEnabledFor(VERBOSE):
self._log(VERBOSE, msg, args, **kw)

def spam(self, *args, **kw):
def spam(self, msg, *args, **kw):
"""Log a message with level :data:`SPAM`. The arguments are interpreted as for :func:`logging.debug()`."""
self.log(SPAM, *args, **kw)
if self.isEnabledFor(SPAM):
self._log(SPAM, msg, args, **kw)
4 changes: 2 additions & 2 deletions verboselogs/tests.py
Expand Up @@ -47,12 +47,12 @@ def test_custom_methods(self):
"""
for name in 'notice', 'verbose', 'spam':
logger = verboselogs.VerboseLogger(random_string())
logger.log = mock.MagicMock()
logger._log = mock.MagicMock()
level = getattr(verboselogs, name.upper())
method = getattr(logger, name.lower())
message = "Any random message"
method(message)
logger.log.assert_called_with(level, message)
logger._log.assert_called_with(level, message, ())

def test_pylint_plugin(self):
"""Test the :mod:`verboselogs.pylint` module."""
Expand Down

0 comments on commit 8d2fe97

Please sign in to comment.