Пример #1
0
    def test_init_without_extra_attr(self):
        """
        Test that the logger adapter uses the thread local var
        if no 'extra' param is provided at init
        """
        log_adp = lc.Adapter(logging.getLogger(__name__))
        self.assertEqual(log_adp.extra, [])

        lc.LOCAL_.ctx.append('foo')
        self.assertEqual(log_adp.extra, ['foo'])
Пример #2
0
import time

from treadmill import appenv
from treadmill import appcfg
from treadmill import fs
from treadmill import dirwatch
from treadmill import logcontext as lc
from treadmill import subproc

from treadmill.appcfg import configure as app_cfg
from treadmill.appcfg import abort as app_abort

if os.name == 'nt':
    from .syscall import winsymlink  # noqa: F401

_LOGGER = lc.Adapter(logging.getLogger(__name__))


_HEARTBEAT_SEC = 30
_WATCHDOG_TIMEOUT_SEC = _HEARTBEAT_SEC * 4


class AppCfgMgr(object):
    """Configure apps from the cache onto the node."""

    __slots__ = (
        'tm_env',
        '_is_active',
    )

    def __init__(self, root):
Пример #3
0
 def test_init_with_extra_attr(self):
     """Test that the logger adapter can be used in the "traditional" way
     """
     log_adp = lc.Adapter(logging.getLogger(__name__), self.appname)
     self.assertEqual(log_adp.extra, [self.appname])