# Path: kano/logging.py
# class lazy_logger:
# class loader:
#     def __getattr__(self, name):
#     def __init__(self, old_mod):
#     def __getattr__(self, name):
# def log_excepthook(exc_class, exc_value, tb):


import os
import sys
import time
import math
from functools import wraps
from kano.logging import logger
        from gi.repository import GObject
# Decorators used to simplify control and ease modularity




ERR_ROOT_PERMISSIONS_REQ = -1


def require_root(exit_on_failure=False, verbose=False):
    '''
    Generates decorator to enforce root permissions

    NB: must be called when used as decorator, i.e.
        @require_root()
        def my_func():
            pass

    @params  exit_on_failure   Quit application on failure
    @params  verbose           Print messages to stdout
    '''

    def require_root_decorator(func):
        '''
        Actual decorator that gets applied to functions
        '''

        @wraps(func)
        def ensure_root(*args, **kwargs):
            if os.getuid() != 0:
                msg = 'You need to run this option as root, try with sudo'

# Path: kano/logging.py
# class lazy_logger:
# class loader:
#     def __getattr__(self, name):
#     def __init__(self, old_mod):
#     def __getattr__(self, name):
# def log_excepthook(exc_class, exc_value, tb):


# Path: kano/decorators.py
import os
import sys
import time
import math
from functools import wraps
from kano.logging import logger
        from gi.repository import GObject

# Decorators used to simplify control and ease modularity




ERR_ROOT_PERMISSIONS_REQ = -1


def require_root(exit_on_failure=False, verbose=False):
    '''
    Generates decorator to enforce root permissions

    NB: must be called when used as decorator, i.e.
        @require_root()
        def my_func():
            pass

    @params  exit_on_failure   Quit application on failure
    @params  verbose           Print messages to stdout
    '''

    def require_root_decorator(func):
        '''
        Actual decorator that gets applied to functions
        '''

        @wraps(func)
        def ensure_root(*args, **kwargs):
            if os.getuid() != 0:
                msg = 'You need to run this option as root, try with sudo'

                logger.error(msg)