How to use the coloredlogs.set_level function in coloredlogs

To help you get started, weā€™ve selected a few coloredlogs 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 xolox / python-redock / redock / tests.py View on Github external
def setUp(self):
        coloredlogs.install()
        coloredlogs.set_level(logging.DEBUG)
github xolox / python-coloredlogs / coloredlogs / tests.py View on Github external
def test_increase_verbosity(self):
        """Make sure increase_verbosity() respects default and custom levels."""
        # Start from a known state.
        set_level(logging.INFO)
        assert get_level() == logging.INFO
        # INFO -> VERBOSE.
        increase_verbosity()
        assert get_level() == logging.VERBOSE
        # VERBOSE -> DEBUG.
        increase_verbosity()
        assert get_level() == logging.DEBUG
        # DEBUG -> SPAM.
        increase_verbosity()
        assert get_level() == logging.SPAM
        # SPAM -> NOTSET.
        increase_verbosity()
        assert get_level() == logging.NOTSET
        # NOTSET -> NOTSET.
        increase_verbosity()
        assert get_level() == logging.NOTSET
github xolox / python-coloredlogs / coloredlogs / tests.py View on Github external
def test_decrease_verbosity(self):
        """Make sure decrease_verbosity() respects default and custom levels."""
        # Start from a known state.
        set_level(logging.INFO)
        assert get_level() == logging.INFO
        # INFO -> NOTICE.
        decrease_verbosity()
        assert get_level() == logging.NOTICE
        # NOTICE -> WARNING.
        decrease_verbosity()
        assert get_level() == logging.WARNING
        # WARNING -> SUCCESS.
        decrease_verbosity()
        assert get_level() == logging.SUCCESS
        # SUCCESS -> ERROR.
        decrease_verbosity()
        assert get_level() == logging.ERROR
        # ERROR -> CRITICAL.
        decrease_verbosity()
        assert get_level() == logging.CRITICAL
github paylogic / pip-accel / pip_accel / tests.py View on Github external
def setUp(self):
        """Reset logging verbosity before each test."""
        coloredlogs.set_level(logging.INFO)
github xolox / python-coloredlogs / coloredlogs / tests.py View on Github external
def test_is_verbose(self):
        """Make sure is_verbose() does what it should :-)."""
        set_level(logging.INFO)
        assert not is_verbose()
        set_level(logging.DEBUG)
        assert is_verbose()
        set_level(logging.VERBOSE)
        assert is_verbose()
github picoCTF / picoCTF / picoCTF-shell / shell_manager / run.py View on Github external
action="store_true",
        default=False,
        help="allow the supplied field to change types if already specified",
    )
    config_set_parser.set_defaults(func=set_configuration_option)

    args = parser.parse_args()

    if args.colorize == "never":
        coloredlogs.DEFAULT_LEVEL_STYLES = {}
        coloredlogs.DEFAULT_FIELD_STYLES = {}

    coloredlogs.install()

    if args.debug:
        coloredlogs.set_level(logging.DEBUG)
    try:
        if "func" in args:
            args.func(args)
        else:
            parser.print_help()
    except FatalException:
        exit(1)
github xolox / python-chat-archive / chat_archive / database.py View on Github external
def __enter__(self):
        """Customize the logging verbosity when entering the :keyword:`with` block."""
        if self.original_level is None:
            self.original_level = get_level()
        set_level(self.level)