How to use the txaio.set_global_log_level function in txaio

To help you get started, we’ve selected a few txaio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github crossbario / txaio / test / test_logging.py View on Github external
def test_emit_noop(handler, framework):
    """
    emit() with a too-low level is an no-op.
    """
    logger = txaio.make_logger()

    old_log = txaio.get_global_log_level()
    txaio.set_global_log_level("info")

    logger.emit("debug", "foobar")

    txaio.set_global_log_level(old_log)

    assert len(handler.messages) == 0
github crossbario / txaio / test / test_logging.py View on Github external
def test_emit_noop(handler, framework):
    """
    emit() with a too-low level is an no-op.
    """
    logger = txaio.make_logger()

    old_log = txaio.get_global_log_level()
    txaio.set_global_log_level("info")

    logger.emit("debug", "foobar")

    txaio.set_global_log_level(old_log)

    assert len(handler.messages) == 0
github crossbario / txaio / test / test_logging.py View on Github external
def test_trace(handler, framework):
    logger = txaio.make_logger()
    old_log = txaio.get_global_log_level()
    txaio.set_global_log_level("trace")

    # the txaio_trace variable should be in it
    logger.trace(
        "trace {txaio_trace}",
    )

    txaio.set_global_log_level(old_log)

    assert len(handler.messages) == 1
    assert handler.messages[0].endswith(b"trace True")
github crossbario / crossbar / crossbar / node / main.py View on Github external
def _start_logging(options, reactor):
    """
    Start the logging in a way that all the subcommands can use it.
    """
    loglevel = getattr(options, "loglevel", "info")
    logformat = getattr(options, "logformat", "none")
    color = getattr(options, "color", "auto")

    set_global_log_level(loglevel)

    # The log observers (things that print to stderr, file, etc)
    observers = []

    if getattr(options, "logtofile", False):
        # We want to log to a file
        if not options.logdir:
            logdir = options.cbdir
        else:
            logdir = options.logdir

        logfile = os.path.join(logdir, "node.log")

        if loglevel in ["error", "warn", "info"]:
            show_source = False
        else:
github buildbot / buildbot / master / buildbot / wamp / connector.py View on Github external
# how would we continue the current transactions ?
        # how would we tell the workers to switch router ?
        if self.app is not None and self.router_url != router_url:
            raise ValueError(
                "Cannot use different wamp router url when reconfiguring")
        if router_url is None:
            return
        self.router_url = router_url
        self.app = self.serviceClass(
            url=self.router_url,
            extra=dict(master=self.master, parent=self),
            realm=bytes2unicode(wamp.get('realm', 'buildbot')),
            make=make
        )
        wamp_debug_level = wamp.get('wamp_debug_level', 'error')
        txaio.set_global_log_level(wamp_debug_level)
        yield self.app.setServiceParent(self)
        yield service.ReconfigurableServiceMixin.reconfigServiceWithBuildbotConfig(self,
                                                                                   new_config)
github crossbario / crossbar / crossbar / _logging.py View on Github external
def __exit__(self, type, value, traceback):
        globalLogPublisher.removeObserver(self._got_log)
        set_global_log_level(self._old_log_level)