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

pantsbuild / pants / 19015773527

02 Nov 2025 05:33PM UTC coverage: 17.872% (-62.4%) from 80.3%
19015773527

Pull #22816

github

web-flow
Merge a12d75757 into 6c024e162
Pull Request #22816: Update Pants internal Python to 3.14

4 of 5 new or added lines in 3 files covered. (80.0%)

28452 existing lines in 683 files now uncovered.

9831 of 55007 relevant lines covered (17.87%)

0.18 hits per line

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

79.31
/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
1✔
5

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

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

13

14
@total_ordering
1✔
15
class LogLevel(Enum):
1✔
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)
1✔
24
    DEBUG = ("debug", logging.DEBUG)
1✔
25
    INFO = ("info", logging.INFO)
1✔
26
    WARN = ("warn", logging.WARN)
1✔
27
    ERROR = ("error", logging.ERROR)
1✔
28

29
    _level: int
1✔
30

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

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

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

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

47
    def __lt__(self, other):
1✔
48
        if not isinstance(other, LogLevel):
×
49
            return NotImplemented
×
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

© 2025 Coveralls, Inc