How to use the daiquiri.formatter.ColorFormatter 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 jd / daiquiri / examples / extra.py View on Github external
import logging

import daiquiri
import daiquiri.formatter

daiquiri.setup(level=logging.INFO, outputs=(
    daiquiri.output.Stream(formatter=daiquiri.formatter.ColorFormatter(
        fmt=(daiquiri.formatter.DEFAULT_FORMAT +
             " [%(subsystem)s is %(mood)s]"))),
    ))

logger = daiquiri.getLogger(__name__, subsystem="example")
logger.info("It works and log to stderr by default with color!",
            mood="happy")
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,
            fork=args.fork,
            setup_only=args.setup_only,
github CermakM / jupyter-require / jupyter_require / __init__.py View on Github external
from .core import communicate

from .core import execute_with_requirements
from .core import execute
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()