Skip to content

Commit 59903bc

Browse files
committed
test: Use INFO as default log level to reduce amount of logs
1 parent e305645 commit 59903bc

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

hathor/cli/util.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ def setup_logging(
157157
else:
158158
handlers = ['pretty']
159159

160+
# Flag to enable debug level for both sync-v1 and sync-v2.
161+
debug_sync = False and debug
162+
160163
# See: https://docs.python.org/3/library/logging.config.html#configuration-dictionary-schema
161164
logging.config.dictConfig({
162165
'version': 1,
@@ -207,6 +210,14 @@ def setup_logging(
207210
'handlers': handlers,
208211
'level': 'DEBUG' if debug else 'INFO',
209212
},
213+
'hathor.p2p.sync_v1': {
214+
'handlers': handlers,
215+
'level': 'DEBUG' if debug_sync else 'INFO',
216+
},
217+
'hathor.p2p.sync_v2': {
218+
'handlers': handlers,
219+
'level': 'DEBUG' if debug_sync else 'INFO',
220+
}
210221
}
211222
})
212223

tests/unittest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from twisted.trial import unittest
1111

1212
from hathor.builder import BuildArtifacts, Builder
13+
from hathor.cli.util import setup_logging
1314
from hathor.conf import HathorSettings
1415
from hathor.conf.get_settings import get_settings
1516
from hathor.daa import TestMode, _set_test_mode
@@ -104,14 +105,15 @@ class TestCase(unittest.TestCase):
104105
seed_config: Optional[int] = None
105106

106107
def setUp(self):
108+
setup_logging()
107109
_set_test_mode(TestMode.TEST_ALL_WEIGHT)
108110
self.tmpdirs = []
109111
self.clock = TestMemoryReactorClock()
110112
self.clock.advance(time.time())
111113
self.log = logger.new()
112114
self.reset_peer_id_pool()
113115
self.seed = secrets.randbits(64) if self.seed_config is None else self.seed_config
114-
self.log.debug('set seed', seed=self.seed)
116+
self.log.info('set seed', seed=self.seed)
115117
self.rng = Random(self.seed)
116118
self._pending_cleanups = []
117119
self._settings = get_settings()

0 commit comments

Comments
 (0)