# Path: igor/log.py
# def configure(fn):
# def backlog():
# def getLogger(name):


from igor import log
import os
import pprint
import yaml

search_paths = [".", "~/.igord", "/etc/igord"]

DATA_DIR = os.path.join(os.path.dirname(__file__), "data")
TMP_DIR = "/var/tmp/"
DATASTORE_DIR = os.path.join(TMP_DIR, "igor-datastore")


def locate_config_file(fn="igord.cfg"):
    filename = None
    for sp in search_paths:
        _filename = os.path.join(sp, fn)
        if os.path.exists(_filename):
            filename = _filename
            break

    if not filename:
        raise RuntimeError("No configuration file found in %s" % search_paths)

    return filename


def parse_config(fn="igord.cfg", updates=None):
    filename = locate_config_file(fn)
    logger.info("Loading config from: %s" % filename)
    with open(filename) as src:
        config = yaml.load(src.read())

    logger.debug("Config: %s" % pprint.pformat(config))


# Path: igor/log.py
# def configure(fn):
# def backlog():
# def getLogger(name):


# Path: igor/daemon/config.py
from igor import log
import os
import pprint
import yaml


search_paths = [".", "~/.igord", "/etc/igord"]

DATA_DIR = os.path.join(os.path.dirname(__file__), "data")
TMP_DIR = "/var/tmp/"
DATASTORE_DIR = os.path.join(TMP_DIR, "igor-datastore")


def locate_config_file(fn="igord.cfg"):
    filename = None
    for sp in search_paths:
        _filename = os.path.join(sp, fn)
        if os.path.exists(_filename):
            filename = _filename
            break

    if not filename:
        raise RuntimeError("No configuration file found in %s" % search_paths)

    return filename


def parse_config(fn="igord.cfg", updates=None):
    filename = locate_config_file(fn)
    logger.info("Loading config from: %s" % filename)
    with open(filename) as src:
        config = yaml.load(src.read())

    logger.debug("Config: %s" % pprint.pformat(config))


    if updates: