import json
import logging
import pprint
import sys
import time

from gallium.interface import ICommand

from .drivers.rabbitmq import Driver
from .observer         import Core, Observer, SYNC_START
from .helper           import prepare_logger

logger = prepare_logger(logging.DEBUG if '-d' in sys.argv else logging.INFO)


def handle_driver_event(level, label, c, summary = None):
    if not c or not hasattr(c, 'route') or not hasattr(c, 'queue_name'):
        getattr(logger, level.lower())(label)

        return