• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 22360764254

24 Feb 2026 04:46PM UTC coverage: 88.798% (-4.1%) from 92.935%
22360764254

Pull #23133

github

web-flow
Merge 4c056364c into 4d038bd74
Pull Request #23133: Add buildctl engine

181 of 264 new or added lines in 8 files covered. (68.56%)

3184 existing lines in 145 files now uncovered.

77555 of 87339 relevant lines covered (88.8%)

3.34 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.21
/src/python/pants/util/logging.py
1
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

4
from __future__ import annotations
9✔
5

6
import logging
9✔
7
from enum import Enum
9✔
8
from functools import total_ordering
9✔
9

10
# A custom log level for pants trace logging.
11
TRACE = 5
9✔
12

13

14
@total_ordering
9✔
15
class LogLevel(Enum):
9✔
16
    """Exposes an enum of the Python `logging` module's levels, with the addition of TRACE.
17

18
    NB: The `logging` module uses the opposite integer ordering of levels from Rust's `log` crate,
19
    but the ordering implementation of this enum inverts its comparison to make its ordering align
20
    with Rust's. That is, TRACE > DEBUG > INFO > WARN > ERROR
21
    """
22

23
    TRACE = ("trace", TRACE)
9✔
24
    DEBUG = ("debug", logging.DEBUG)
9✔
25
    INFO = ("info", logging.INFO)
9✔
26
    WARN = ("warn", logging.WARN)
9✔
27
    ERROR = ("error", logging.ERROR)
9✔
28

29
    _level: int
9✔
30

31
    def __new__(cls, value: str, level: int) -> LogLevel:
9✔
32
        member: LogLevel = object.__new__(cls)
9✔
33
        member._value_ = value
9✔
34
        member._level = level
9✔
35
        return member
9✔
36

37
    @property
9✔
38
    def level(self) -> int:
9✔
39
        return self._level
9✔
40

41
    def log(self, logger: logging.Logger, *args, **kwargs) -> None:
9✔
42
        logger.log(self._level, *args, **kwargs)
×
43

44
    def set_level_for(self, logger: logging.Logger):
9✔
45
        logger.setLevel(self.level)
9✔
46

47
    def __lt__(self, other):
9✔
UNCOV
48
        if not isinstance(other, LogLevel):
×
49
            return NotImplemented
×
UNCOV
50
        return self._level > other._level
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc