<gh_stars>1-10
#!/usr/bin python3

"""
<Description of the programme>

Author:        <NAME> <<EMAIL>>
Created:       12 Jul 2020
License:       MIT
Contributors:  <NAME>
"""

# Imports
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Python:
from functools import wraps
import logging

# 3rd party:

# Internal: 
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Header
__author__ = "<NAME>"
__copyright__ = "Copyright (c) 2020, Public Health England"
__license__ = "MIT"
__version__ = "0.0.1"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

__all__ = [
    'func_logger'
]


def func_logger(process_name):
    def logger(func):
        @wraps(func)
        def process_func(*args, **kwargs):
            logging.info(f"> Starting: {process_name}")

            try:
                result = func(*args, **kwargs)
            except Exception as e:
                logging.error(f">> Exception occurred in {process_name}")
                logging.exception(e)
                raise e

            logging.info(f"  Complete: {process_name}")

            return result

        return process_func

    return logger

#!/usr/bin python3

"""
<Description of the programme>

Author:        <NAME> <<EMAIL>>
Created:       12 Jul 2020
License:       MIT
Contributors:  <NAME>
"""

# Imports
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Python:
from functools import wraps
import logging

# 3rd party:

# Internal: 
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Header
__author__ = "<NAME>"
__copyright__ = "Copyright (c) 2020, Public Health England"
__license__ = "MIT"
__version__ = "0.0.1"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

__all__ = [
    'func_logger'
]


def func_logger(process_name):
    def logger(func):
        @wraps(func)
        def process_func(*args, **kwargs):
            logging.info(f"> Starting: {process_name}")

            try:
                result = func(*args, **kwargs)
            except Exception as e:
                logging.error(f">> Exception occurred in {process_name}")
                logging.exception(e)
                raise e

            logging.info(f"  Complete: {process_name}")

            return result

        return process_func

    return logger
#!/usr/bin python3 <Description of the programme>  Author:        <NAME> <<EMAIL>> Created:       12 Jul 2020 License:       MIT Contributors:  <NAME> # Imports # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Python: # 3rd party: # Internal: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Header # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~