Skip to content

Commit

Permalink
fixup: fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
gsilvapt committed Mar 11, 2024
1 parent 40071f3 commit 1382c7f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion logbasecommand/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.0.2'
__version__ = "0.0.2"
19 changes: 11 additions & 8 deletions logbasecommand/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class LogBaseCommand(BaseCommand):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
prefix = getattr(settings, 'LOGBASECOMMAND_PREFIX', None) or __name__
self.logger = logging.getLogger(prefix + '.' + self.__module__.split('.')[-1])
prefix = getattr(settings, "LOGBASECOMMAND_PREFIX", None) or __name__
self.logger = logging.getLogger(prefix + "." + self.__module__.split(".")[-1])

def __handle_custom_std(self, ifstd, std, msg, *args):
if ifstd:
Expand Down Expand Up @@ -52,16 +52,19 @@ def log_exception(self, msg, *args, **kwargs):
return self.logger.exception(msg, *args, **kwargs)

def execute(self, *args, **options):
self.verbosity = options['verbosity']
self.verbosity = options["verbosity"]
self.logger.setLevel(
[logging.ERROR, max(self.logger.getEffectiveLevel(), logging.INFO), logging.DEBUG, logging.DEBUG][
self.verbosity
]
[
logging.ERROR,
max(self.logger.getEffectiveLevel(), logging.INFO),
logging.DEBUG,
logging.DEBUG,
][self.verbosity]
)

if options.get('stdout') is not None:
if options.get("stdout") is not None:
self.custom_stdout = True
if options.get('stderr') is not None:
if options.get("stderr") is not None:
self.custom_stderr = True

super().execute(*args, **options)

0 comments on commit 1382c7f

Please sign in to comment.