# Path: src/main.py
# def on_shutdown():
# 
# Path: src/logcfg.py
# DEBUG_TEMPL = '  %(levelname)-7.7s %(funcName)s: %(message)s'
# PROD_TEMPL  = '%(asctime)s %(levelname)-7.7s %(funcName)s: %(message)s'
# DEBUG = logging.DEBUG
# class ColorFmtr(Formatter):
#     def __init__(self, *args, **kwargs):
#     def format(self, record):
# def makefunc(level):
#         def tb_func(msg, *args, **kwargs):
#     def thefunc(msg, *args, **kwargs):


from os.path import exists, join
from flask.json import JSONEncoder
from ipaddress import _BaseAddress
from pytz.tzinfo import DstTzInfo
from .main import app
from .logcfg import log




class CustomJSONEncoder(JSONEncoder):
    ''' Handles odd datatypes. '''
    def default(self, obj):
        if isinstance(obj, (_BaseAddress, DstTzInfo)):
            return str(obj)
        return JSONEncoder.default(self, obj)



# Path: src/main.py
# def on_shutdown():
# 
# Path: src/logcfg.py
# DEBUG_TEMPL = '  %(levelname)-7.7s %(funcName)s: %(message)s'
# PROD_TEMPL  = '%(asctime)s %(levelname)-7.7s %(funcName)s: %(message)s'
# DEBUG = logging.DEBUG
# class ColorFmtr(Formatter):
#     def __init__(self, *args, **kwargs):
#     def format(self, record):
# def makefunc(level):
#         def tb_func(msg, *args, **kwargs):
#     def thefunc(msg, *args, **kwargs):


# Path: src/utils.py
from os.path import exists, join
from flask.json import JSONEncoder
from ipaddress import _BaseAddress
from pytz.tzinfo import DstTzInfo
from .main import app
from .logcfg import log





class CustomJSONEncoder(JSONEncoder):
    ''' Handles odd datatypes. '''
    def default(self, obj):
        if isinstance(obj, (_BaseAddress, DstTzInfo)):
            return str(obj)
        return JSONEncoder.default(self, obj)



app.json_encoder = CustomJSONEncoder