Bladeren bron

Add Python All Loggers

Add the snippet that allows all configured loggers to be retrieved in
Python and fix a missing import in ascii_only.
master
Nate Bohman 3 jaren geleden
bovenliggende
commit
d701948f60
Getekend door: Nate Bohman <natrinicle@gmail.com> GPG sleutel-ID: C10546A54ABA1CE5
2 gewijzigde bestanden met toevoegingen van 11 en 1 verwijderingen
  1. +9
    -0
      python_utils/all_loggers.py
  2. +2
    -1
      python_utils/ascii_only.py

+ 9
- 0
python_utils/all_loggers.py Bestand weergeven

@@ -0,0 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import logging

all_except_root_loggers = [
logging.getLogger(name) for name in logging.root.manager.loggerDict
]
all_loggers = [logging.getLogger(), *all_except_root_loggers]

+ 2
- 1
python_utils/ascii_only.py Bestand weergeven

@@ -1,11 +1,12 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import logging
import re

logger = logging.getLogger(__name__)

ascii_characters = [chr(i) for i in range(32,127)]
ascii_characters = [chr(i) for i in range(32, 127)]
ascii_char_rgx = re.compile("{}".format(re.escape(ascii_characters)))



Laden…
Annuleren
Opslaan