Example #1
0
from kingpin import utils
from kingpin.actors import exceptions
from kingpin.actors.utils import timer
from kingpin.constants import REQUIRED, STATE

log = logging.getLogger(__name__)

__author__ = 'Matt Wise <*****@*****.**>'


# If super-debug logging is enabled, then we turn on the URLLIB3 HTTP
# request logging. This is extremely verbose and insecure, but useful
# for troubleshooting. URLLIB3 is used by several actors (aws, rightscale),
# so we do this setup here in the base actor class.
if os.getenv('URLLIB_DEBUG', None):
    utils.super_httplib_debug_logging()

# Allow the user to override the default_timeout for all actors by setting an
# environment variable
DEFAULT_TIMEOUT = os.getenv('DEFAULT_TIMEOUT', 3600)


class LogAdapter(logging.LoggerAdapter):

    """Simple Actor Logging Adapter.

    Provides a common logging format for actors that uses the actors
    description and dry parameter as a prefix to the supplied log message.
    """

    def process(self, msg, kwargs):
Example #2
0
 def test_super_httplib_debug_logging(self):
     logger = utils.super_httplib_debug_logging()
     self.assertEqual(10, logger.level)
Example #3
0
from kingpin import utils
from kingpin.actors import exceptions
from kingpin.actors.utils import timer
from kingpin.constants import REQUIRED, STATE

log = logging.getLogger(__name__)

__author__ = 'Matt Wise <*****@*****.**>'

# If super-debug logging is enabled, then we turn on the URLLIB3 HTTP
# request logging. This is extremely verbose and insecure, but useful
# for troubleshooting. URLLIB3 is used by several actors (aws, rightscale),
# so we do this setup here in the base actor class.
if os.getenv('URLLIB_DEBUG', None):
    utils.super_httplib_debug_logging()

# Allow the user to override the default_timeout for all actors by setting an
# environment variable
DEFAULT_TIMEOUT = os.getenv('DEFAULT_TIMEOUT', 3600)


class LogAdapter(logging.LoggerAdapter):
    """Simple Actor Logging Adapter.

    Provides a common logging format for actors that uses the actors
    description and dry parameter as a prefix to the supplied log message.
    """
    def process(self, msg, kwargs):
        return ('[%s%s] %s' % (self.extra['dry'], self.extra['desc'], msg),
                kwargs)
Example #4
0
 def test_super_httplib_debug_logging(self):
     logger = utils.super_httplib_debug_logging()
     self.assertEquals(10, logger.level)