Coverage for JLC2KiCadLib/helper.py: 23%

1 import logging

2 import sys

3

4

5 def set_logging(logging_level, logging_file):

6 LOGGING_FILE = "JLC2KiCad_lib.log"

7

8 if logging_file:

9 logging.basicConfig(

10 filename=LOGGING_FILE, format="%(asctime)s - %(levelname)s - %(message)s"

11 )

12

13 root_logger = logging.getLogger()

14 root_logger.setLevel(logging_level)

15 handler = logging.StreamHandler(sys.stdout)

16 handler.setLevel(logging.INFO)

17 root_logger.addHandler(handler)

18 formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")

19 handler.setFormatter(formatter)