示例#1
0
def _setup_logging(verbose):
    """Try to use lumberjack to enable logging when in a subprocess."""
    try:
        import lumberjack

        lumberjack.setup_logging("DFW.Broker", mode="stream", level=30 - 10 * verbose)
        lumberjack.setup_warnings_logger("DFW.Broker")
    except:
        pass
示例#2
0
def pytest_configure(config):
    """Activate log capturing if appropriate."""

    if (not _pytest_get_option(config, 'capturelog', default=True)) or (_pytest_get_option(config, 'capture', default="no") == "no"):
        try:
            import lumberjack
            lumberjack.setup_logging("", mode='stream', level=1)
            lumberjack.setup_warnings_logger("")
        except:
            pass
    else:
        try:
            import lumberjack
            lumberjack.setup_logging("", mode='none', level=1)
            lumberjack.setup_warnings_logger("")
        except:
            pass
示例#3
0
def pytest_configure(config):
    """Activate log capturing if appropriate."""

    if (not _pytest_get_option(config, 'capturelog', default=True)) or (
            _pytest_get_option(config, 'capture', default="no") == "no"):
        try:
            import lumberjack
            lumberjack.setup_logging("", mode='stream', level=1)
            lumberjack.setup_warnings_logger("")
        except:
            pass
    else:
        try:
            import lumberjack
            lumberjack.setup_logging("", mode='none', level=1)
            lumberjack.setup_warnings_logger("")
        except:
            pass
示例#4
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Demonstrate REDIS read-write ability.
"""
import time
from lumberjack import setup_logging, setup_warnings_logger
from logging import getLogger

setup_logging(mode='stream', level=5)
setup_warnings_logger("")
log = getLogger("example.zmq")

# Get ready!
from Cauldron.api import use
use("zmq")

from Cauldron import DFW


def setup(service):
    """Setup the service."""
    kwd = DFW.Keyword.Keyword("TEST", service)
    print("Service setup")


disp = DFW.Service("testsvc", setup=setup, config=None)
dtest = disp["TEST"]
log.info("Dispatcher Keyword {0!r}".format(dtest))

VALUE = "SOMEVALUE"
示例#5
0
# -*- coding: utf-8 -*-
"""
Console scripts for KTL.
"""

import argparse
import collections
import time
import logging
import sys

from .exc import TimeoutError, DispatcherError

try:
    import lumberjack
    lumberjack.setup_warnings_logger()
except:
    pass

class BackendAction(argparse.Action):
    """An action to select a KTL backend."""
    
    def __init__(self, option_strings, dest, **kwargs):
        """Handle add_argument args."""
        kwargs['nargs'] = 1
        kwargs['const'] = None
        kwargs.setdefault('default','ktl')
        kwargs['type'] = str
        kwargs['choices'] = None
        kwargs.setdefault('required', False)
        kwargs.setdefault('help', "The Cauldron backend to use.")
示例#6
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Demonstrate REDIS read-write ability.
"""
import time
from lumberjack import setup_logging, setup_warnings_logger
from logging import getLogger

setup_logging(mode='stream', level=5)
setup_warnings_logger("")
log = getLogger("example.zmq")

# Get ready!
from Cauldron.api import use
use("zmq")

from Cauldron import DFW

def setup(service):
    """Setup the service."""
    kwd = DFW.Keyword.Keyword("TEST", service)
    print("Service setup")

disp = DFW.Service("testsvc", setup = setup, config=None)
dtest = disp["TEST"]
log.info("Dispatcher Keyword {0!r}".format(dtest))

VALUE = "SOMEVALUE"
time.sleep(1.0)
log.info("Starting KTL client...")
示例#7
0
# -*- coding: utf-8 -*-
"""
Console scripts for KTL.
"""

import argparse
import collections
import time
import logging
import sys

from .exc import TimeoutError, DispatcherError

try:
    import lumberjack
    lumberjack.setup_warnings_logger()
except:
    pass


class BackendAction(argparse.Action):
    """An action to select a KTL backend."""
    def __init__(self, option_strings, dest, **kwargs):
        """Handle add_argument args."""
        kwargs['nargs'] = 1
        kwargs['const'] = None
        kwargs.setdefault('default', 'ktl')
        kwargs['type'] = str
        kwargs['choices'] = None
        kwargs.setdefault('required', False)
        kwargs.setdefault('help', "The Cauldron backend to use.")