mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 00:04:42 +04:00
Centralize logging initialization
This commit is contained in:
parent
323507c9e3
commit
a7169905dc
18 changed files with 26 additions and 43 deletions
|
|
@ -6,6 +6,8 @@ from pre_commit import color
|
|||
from pre_commit import output
|
||||
|
||||
|
||||
logger = logging.getLogger('pre_commit')
|
||||
|
||||
LOG_LEVEL_COLORS = {
|
||||
'DEBUG': '',
|
||||
'INFO': '',
|
||||
|
|
@ -30,3 +32,8 @@ class LoggingHandler(logging.Handler):
|
|||
record.getMessage(),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def add_logging_handler(*args, **kwargs):
|
||||
logger.addHandler(LoggingHandler(*args, **kwargs))
|
||||
logger.setLevel(logging.INFO)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue