How to use the daiquiri.output function in daiquiri

To help you get started, we’ve selected a few daiquiri 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 Mergifyio / git-pull-request / git_pull_request / __init__.py View on Github external
def main():
    args = build_parser().parse_args()

    daiquiri.setup(
        outputs=(
            daiquiri.output.Stream(
                sys.stdout,
                formatter=daiquiri.formatter.ColorFormatter(
                    fmt="%(color)s%(message)s%(color_stop)s")),),
        level=logging.DEBUG if args.debug else logging.INFO,
    )

    try:
        return git_pull_request(
            target_remote=args.target_remote,
            target_branch=args.target_branch,
            title=args.title,
            message=args.message,
            comment=args.comment,
            rebase=not args.no_rebase,
            download=args.download,
            download_setup=args.download_setup,
github Oslandia / deeposlandia / deeposlandia / __init__.py View on Github external
import logging
import os

import daiquiri

__version__ = "0.6.3.post1"


# Do not log Tensorflow messages
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

# Configure the logger
daiquiri.setup(
    level=logging.INFO,
    outputs=(
        daiquiri.output.Stream(
            formatter=daiquiri.formatter.ColorFormatter(
                fmt=(
                    "%(asctime)s :: %(levelname)s :: %(module)s :: "
                    "%(funcName)s : %(color)s%(message)s%(color_stop)s"
                )
            )
        ),
    ),
)
logger = daiquiri.getLogger("root")

# Deeposlandia supports feature detection (featdet) and semantic segmentation (semseg)
AVAILABLE_MODELS = ("featdet", "semseg")

# Configuration file handling
_DEEPOSL_CONFIG = os.getenv("DEEPOSL_CONFIG")
github jd / daiquiri / daiquiri / __init__.py View on Github external
:param level: Root log level.
    :param outputs: Iterable of outputs to log to.
    :param program_name: The name of the program. Auto-detected if not set.
    :param capture_warnings: Capture warnings from the `warnings' module.
    """
    root_logger = logging.getLogger(None)

    # Remove all handlers
    for handler in list(root_logger.handlers):
        root_logger.removeHandler(handler)

    # Add configured handlers
    for out in outputs:
        if isinstance(out, str):
            out = output.preconfigured.get(out)
            if out is None:
                raise RuntimeError("Output {} is not available".format(out))
        out.add_to_logger(root_logger)

    root_logger.setLevel(level)

    program_logger = logging.getLogger(program_name)

    def logging_excepthook(exc_type, value, tb):
        program_logger.critical(
            "".join(traceback.format_exception(exc_type, value, tb)))

    sys.excepthook = logging_excepthook

    if capture_warnings:
        logging.captureWarnings(True)
github IBM / matrix-capsules-with-em-routing / config.py View on Github external
def setup_logger(logger_dir, name="logger"):
  os.environ['TZ'] = 'Africa/Johannesburg'
  time.tzset()
  daiquiri_formatter = daiquiri.formatter.ColorFormatter(
      fmt= "%(asctime)s %(color)s%(levelname)s: %(message)s%(color_stop)s",
      datefmt="%Y-%m-%d %H:%M:%S")
  logger_path = os.path.join(logger_dir, name)
  daiquiri.setup(level=logging.INFO, outputs=(
      daiquiri.output.Stream(formatter=daiquiri_formatter),
      daiquiri.output.File(logger_path,formatter=daiquiri_formatter),
     ))
github CermakM / jupyter-require / jupyter_require / __init__.py View on Github external
from .core import safe_execute
from .core import require

from IPython import get_ipython

daiquiri.setup(
    level=logging.DEBUG,
    outputs=[
        daiquiri.output.File(
            level=logging.DEBUG,
            filename='.log',
            formatter=daiquiri.formatter.ColorFormatter(
                fmt="%(asctime)s [%(process)d] %(color)s%(levelname)-8.8s %(name)s:"
                    "%(lineno)d: [JupyterRequire] %(message)s%(color_stop)s"
            )),
        daiquiri.output.Stream(
            level=logging.WARN,
            formatter=daiquiri.formatter.ColorFormatter(
                fmt="%(asctime)s [%(process)d] %(color)s%(levelname)-8.8s %(name)s:"
                    "%(lineno)d: [JupyterRequire] %(message)s%(color_stop)s"
            )
        ),
    ],
)

logger = daiquiri.getLogger()


def load_ipython_extension(ipython):
    """Load the IPython Jupyter Require extension."""
    from .magic import RequireJSMagic