# Path: tuskar/openstack/common/gettextutils.py
# def _(msg):
#     return _t.ugettext(msg)
# 
# Path: tuskar/openstack/common/importutils.py
# def import_class(import_str):
# def import_object(import_str, *args, **kwargs):
# def import_object_ns(name_space, import_str, *args, **kwargs):
# def import_module(import_str):
# def try_import(import_str, default=None):
# 
# Path: tuskar/openstack/common/jsonutils.py
# def to_primitive(value, convert_instances=False, convert_datetime=True,
#                  level=0, max_depth=3):
# def dumps(value, default=to_primitive, **kwargs):
# def loads(s):
# def load(s):
# 
# Path: tuskar/openstack/common/local.py
# class WeakLocal(corolocal.local):
#     def __getattribute__(self, attr):
#     def __setattr__(self, attr, value):


import ConfigParser
import cStringIO
import inspect
import itertools
import logging
import logging.config
import logging.handlers
import os
import sys
import traceback
from oslo.config import cfg
from tuskar.openstack.common.gettextutils import _
from tuskar.openstack.common import importutils
from tuskar.openstack.common import jsonutils
from tuskar.openstack.common import local
    return facility


def _setup_logging_from_conf():
    log_root = getLogger(None).logger
    for handler in log_root.handlers:
        log_root.removeHandler(handler)

    if CONF.use_syslog:
        facility = _find_facility_from_conf()
        syslog = logging.handlers.SysLogHandler(address='/dev/log',
                                                facility=facility)
        log_root.addHandler(syslog)

    logpath = _get_log_file_path()
    if logpath:
        filelog = logging.handlers.WatchedFileHandler(logpath)
        log_root.addHandler(filelog)

    if CONF.use_stderr:
        streamlog = ColorHandler()
        log_root.addHandler(streamlog)

    elif not CONF.log_file:
        # pass sys.stdout as a positional argument
        # python2.6 calls the argument strm, in 2.7 it's stream
        streamlog = logging.StreamHandler(sys.stdout)
        log_root.addHandler(streamlog)

    if CONF.publish_errors:

# Path: tuskar/openstack/common/gettextutils.py
# def _(msg):
#     return _t.ugettext(msg)
# 
# Path: tuskar/openstack/common/importutils.py
# def import_class(import_str):
# def import_object(import_str, *args, **kwargs):
# def import_object_ns(name_space, import_str, *args, **kwargs):
# def import_module(import_str):
# def try_import(import_str, default=None):
# 
# Path: tuskar/openstack/common/jsonutils.py
# def to_primitive(value, convert_instances=False, convert_datetime=True,
#                  level=0, max_depth=3):
# def dumps(value, default=to_primitive, **kwargs):
# def loads(s):
# def load(s):
# 
# Path: tuskar/openstack/common/local.py
# class WeakLocal(corolocal.local):
#     def __getattribute__(self, attr):
#     def __setattr__(self, attr, value):


# Path: tuskar/openstack/common/log.py
import ConfigParser
import cStringIO
import inspect
import itertools
import logging
import logging.config
import logging.handlers
import os
import sys
import traceback
from oslo.config import cfg
from tuskar.openstack.common.gettextutils import _
from tuskar.openstack.common import importutils
from tuskar.openstack.common import jsonutils
from tuskar.openstack.common import local

    return facility


def _setup_logging_from_conf():
    log_root = getLogger(None).logger
    for handler in log_root.handlers:
        log_root.removeHandler(handler)

    if CONF.use_syslog:
        facility = _find_facility_from_conf()
        syslog = logging.handlers.SysLogHandler(address='/dev/log',
                                                facility=facility)
        log_root.addHandler(syslog)

    logpath = _get_log_file_path()
    if logpath:
        filelog = logging.handlers.WatchedFileHandler(logpath)
        log_root.addHandler(filelog)

    if CONF.use_stderr:
        streamlog = ColorHandler()
        log_root.addHandler(streamlog)

    elif not CONF.log_file:
        # pass sys.stdout as a positional argument
        # python2.6 calls the argument strm, in 2.7 it's stream
        streamlog = logging.StreamHandler(sys.stdout)
        log_root.addHandler(streamlog)

    if CONF.publish_errors:

        handler = importutils.import_object(