Skip to content

Commit

Permalink
Merge pull request #2588 from zyzniewski-reef/fix/2337-btlogging_setL…
Browse files Browse the repository at this point in the history
…evel

fix(2337): btlogging setLevel
  • Loading branch information
zyzniewski-reef authored Jan 21, 2025
2 parents 72dd8ad + 2a148ab commit 7ccb07d
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 2 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 8.5.2 /2025-01-17

## What's Changed
* Feat/use tx pool for set weights by @camfairchild in https://github.com/opentensor/bittensor/pull/2534
* fix get_delegates result decoding by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2551
* [SDK] Handle server connection limit by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2553
* Backmerge master to staging post 851 by @ibraheem-opentensor in https://github.com/opentensor/bittensor/pull/2557
* [SDK] Improve InvalidStatus handler by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2558
* [SDK] Add async version of commit reveal v3 by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2560
* Use apt-get instead of apt for scripts by @camfairchild in https://github.com/opentensor/bittensor/pull/2571
* fix _do_stake incorrect arguments error in staking.py by @Assh-codes in https://github.com/opentensor/bittensor/pull/2574
* Updates tests for btwallet 3.0.0 by @ibraheem-opentensor in https://github.com/opentensor/bittensor/pull/2540
* Bumps cr3 FFI by @ibraheem-opentensor in https://github.com/opentensor/bittensor/pull/2583

## New Contributors
* @Assh-codes made their first contribution in https://github.com/opentensor/bittensor/pull/2574

**Full Changelog**: https://github.com/opentensor/bittensor/compare/v8.5.1...v8.5.2

## 8.5.1 /2024-12-16

## What's Changed
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.5.1
8.5.2
2 changes: 1 addition & 1 deletion bittensor/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

__version__ = "8.5.1"
__version__ = "8.5.2"

import os
import re
Expand Down
4 changes: 4 additions & 0 deletions bittensor/utils/btlogging/loggingmachine.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,10 @@ def get_level(self) -> int:
"""Returns Logging level."""
return self._logger.level

def setLevel(self, level):
"""Set the specified level on the underlying logger."""
self._logger.setLevel(level)

def check_config(self, config: "Config"):
assert config.logging

Expand Down
22 changes: 22 additions & 0 deletions tests/unit_tests/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,25 @@ def test_all_log_levels_output(logging_machine, caplog):
def test_concat(msg, prefix, suffix, expected_result):
"""Test different options of message concatenation with prefix and suffix."""
assert _concat_message(msg, prefix, suffix) == expected_result


def test_logger_level(logging_machine, caplog):
"""Test get/set Logger level."""

assert logging_machine.get_level() == stdlogging.WARN

logging_machine.info("info1")
logging_machine.warning("warn1")

assert "info1" not in caplog.text
assert "warn1" in caplog.text

logging_machine.setLevel(stdlogging.INFO)

assert logging_machine.get_level() == stdlogging.INFO

logging_machine.info("info2")
logging_machine.warning("warn2")

assert "info2" in caplog.text
assert "warn2" in caplog.text

0 comments on commit 7ccb07d

Please sign in to comment.