2017-10-26 04:47:33 +00:00
|
|
|
import logging
|
|
|
|
|
2022-12-02 20:12:10 +00:00
|
|
|
import borgmatic.logger
|
|
|
|
|
2019-11-03 08:55:19 +00:00
|
|
|
VERBOSITY_ERROR = -1
|
2022-12-02 20:12:10 +00:00
|
|
|
VERBOSITY_ANSWER = 0
|
2015-07-18 04:58:50 +00:00
|
|
|
VERBOSITY_SOME = 1
|
|
|
|
VERBOSITY_LOTS = 2
|
2017-10-26 04:47:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
def verbosity_to_log_level(verbosity):
|
|
|
|
'''
|
|
|
|
Given a borgmatic verbosity value, return the corresponding Python log level.
|
|
|
|
'''
|
2022-12-02 20:12:10 +00:00
|
|
|
borgmatic.logger.add_custom_log_levels()
|
|
|
|
|
2017-10-26 04:47:33 +00:00
|
|
|
return {
|
2019-11-03 08:55:19 +00:00
|
|
|
VERBOSITY_ERROR: logging.ERROR,
|
2022-12-02 20:12:10 +00:00
|
|
|
VERBOSITY_ANSWER: logging.ANSWER,
|
2017-10-26 04:47:33 +00:00
|
|
|
VERBOSITY_SOME: logging.INFO,
|
|
|
|
VERBOSITY_LOTS: logging.DEBUG,
|
2018-03-04 06:17:39 +00:00
|
|
|
}.get(verbosity, logging.WARNING)
|