Skip to content

Commit

Permalink
committed stray bulkDGD/util.py file
Browse files Browse the repository at this point in the history
  • Loading branch information
ValeSora committed Jul 19, 2024
1 parent 82289d2 commit 53758f2
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions bulkDGD/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,24 @@ def filter(self,


def get_handlers(log_console = True,
log_level_console = defaults.LOG_LEVEL,
log_file_class = None,
log_file_options = None,
log_level = defaults.LOG_LEVEL):
log_level_file = defaults.LOG_LEVEL):
"""Get the handlers to use when logging.
Parameters
----------
log_console : ``bool``, ``True``
Whether to write log messages to the console.
log_level_console : ``str``, ``bulkDGD.defaults.LOG_LEVEL``
The level below which log messages will not be logged on the
console.
By default, it takes the value of
``bulkDGD.defaults.LOG_LEVEL``.
log_file_class : ``logging.FileHandler``, optional
A ``FileHandler`` class to construct the handler that will
log to a file.
Expand All @@ -205,8 +213,9 @@ def get_handlers(log_console = True,
It must be provided if ``log_file_class`` is provided.
log_level : ``str``, ``bulkDGD.defaults.LOG_LEVEL``
The level below which log messages will be ignored.
log_level_file : ``str``, ``bulkDGD.defaults.LOG_LEVEL``
The level below which log messages will not be logged to the
file.
By default, it takes the value of
``bulkDGD.defaults.LOG_LEVEL``.
Expand All @@ -229,7 +238,7 @@ def get_handlers(log_console = True,
handler = log.StreamHandler()

# Set the handler's level.
handler.setLevel(log_level)
handler.setLevel(log_level_console)

# Add the handler to the list of handlers.
handlers.append(handler)
Expand Down Expand Up @@ -275,7 +284,7 @@ def get_handlers(log_console = True,
handler = log_file_class(**log_file_options)

# Set the handler's level.
handler.setLevel(log_level)
handler.setLevel(log_level_file)

# Add the handler to the list of handlers.
handlers.append(handler)
Expand Down

0 comments on commit 53758f2

Please sign in to comment.