Skip to content

Commit

Permalink
Rename set_level special kwarg to _set_level
Browse files Browse the repository at this point in the history
  • Loading branch information
nir0s committed Feb 24, 2018
1 parent eb21399 commit e1ea5c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ try:
config = read_config(PATH)
except ReadError as ex:
# Can also pass `set_level` to `critical`, not just to `error`.
wryter.error('Failed to read config ({})'.format(ex), {'context': context}, set_level='debug')
wryter.error('Failed to read config ({})'.format(ex), {'context': context}, _set_level='debug')
# do_something to reread the file, but this time with debug logging enabled.
config_file_read = True
finally:
Expand Down
12 changes: 6 additions & 6 deletions wryte.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,16 +390,16 @@ def warning(self, message, *objects, **kwargs):
self.logger.warning(obj)

def error(self, message, *objects, **kwargs):
if kwargs.get('set_level'):
self.set_level(kwargs.get('set_level'))
kwargs.pop('set_level')
if kwargs.get('_set_level'):
self.set_level(kwargs.get('_set_level'))
kwargs.pop('_set_level')
obj = self._enrich(message, 'error', objects, kwargs)
self.logger.error(obj)

def critical(self, message, *objects, **kwargs):
if kwargs.get('set_level'):
self.set_level(kwargs.get('set_level'))
kwargs.pop('set_level')
if kwargs.get('_set_level'):
self.set_level(kwargs.get('_set_level'))
kwargs.pop('_set_level')
obj = self._enrich(message, 'critical', objects, kwargs)
self.logger.critical(obj)

Expand Down

0 comments on commit e1ea5c1

Please sign in to comment.