How to use the aiorun.logger.disabled function in aiorun

To help you get started, we’ve selected a few aiorun 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 kdrag0n / pyrobud / pyrobud / launch.py View on Github external
import asyncio
import logging
import sys
from pathlib import Path

import aiorun
import tomlkit

from . import DEFAULT_CONFIG_PATH, util
from .core import Bot

log = logging.getLogger("launch")
# Silence aiorun's overly verbose logger
aiorun.logger.disabled = True


def setup_asyncio(config: util.config.Config) -> asyncio.AbstractEventLoop:
    """Returns a new asyncio event loop with settings from the given config."""

    asyncio_config: util.config.AsyncIOConfig = config["asyncio"]

    if sys.platform == "win32":
        # Force ProactorEventLoop on Windows for subprocess support
        policy = asyncio.WindowsProactorEventLoopPolicy()
        asyncio.set_event_loop_policy(policy)
    elif not asyncio_config["disable_uvloop"]:
        # Initialize uvloop if available
        try:
            # noinspection PyUnresolvedReferences
            import uvloop

aiorun

Boilerplate for asyncio applications

Apache-2.0
Latest version published 3 months ago

Package Health Score

74 / 100
Full package analysis