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