Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 0593022

Browse files
committed
slogging is_active is not a propery
1 parent ba64866 commit 0593022

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

ethereum/processblock.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,13 @@ def apply_msg(ext, msg):
209209

210210

211211
def _apply_msg(ext, msg, code):
212-
if log_msg.is_active:
212+
if log_msg.is_active('trace'):
213213
log_msg.debug("MSG APPLY", sender=encode_hex(msg.sender), to=encode_hex(msg.to),
214214
gas=msg.gas, value=msg.value,
215215
data=encode_hex(msg.data.extract_all()))
216-
if log_state.is_active:
217-
log_state.trace('MSG PRE STATE', account=msg.to, bal=ext.get_balance(msg.to), state=ext.log_storage(msg.to))
216+
if log_state.is_active('trace'):
217+
log_state.trace('MSG PRE STATE', account=msg.to, bal=ext.get_balance(
218+
msg.to), state=ext.log_storage(msg.to))
218219
# Transfer value, instaquit if not enough
219220
snapshot = ext._block.snapshot()
220221
o = ext._block.transfer_value(msg.sender, msg.to, msg.value)
@@ -229,11 +230,12 @@ def _apply_msg(ext, msg, code):
229230
res, gas, dat = vm.vm_execute(ext, msg, code)
230231
gas = int(gas)
231232
assert utils.is_numeric(gas)
232-
if log_msg.is_active:
233+
if log_msg.is_active('trace'):
233234
log_msg.debug('MSG APPLIED', result=o, gas_remained=gas,
234235
sender=msg.sender, to=msg.to, data=dat)
235-
if log_state.is_active:
236-
log_state.trace('MSG POST STATE', account=msg.to, bal=ext.get_balance(msg.to), state=ext.log_storage(msg.to))
236+
if log_state.is_active('trace'):
237+
log_state.trace('MSG POST STATE', account=msg.to, bal=ext.get_balance(
238+
msg.to), state=ext.log_storage(msg.to))
237239

238240
if res == 0:
239241
log_msg.debug('REVERTING')

ethereum/tests/test_logging.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ def test_baseconfig():
7070
th = setup_logging(config_string=config_string)
7171

7272

73+
def test_is_active2():
74+
setup_logging(':info')
75+
tester = slogging.get_logger('tester')
76+
assert tester.is_active(level_name='info')
77+
assert not tester.is_active(level_name='trace')
78+
79+
7380
def test_lvl_trace():
7481
config_string = ':trace'
7582
th = setup_logging(config_string=config_string)
@@ -317,3 +324,12 @@ def run_vm(raise_error=False):
317324
def test_cleanup():
318325
config_string = ':debug'
319326
slogging.configure(config_string=config_string)
327+
328+
329+
if __name__ == '__main__':
330+
slogging.configure(':debug')
331+
tester = slogging.get_logger('tester')
332+
assert tester.is_active(level_name='info')
333+
slogging.set_level('tester', 'trace')
334+
assert tester.is_active(level_name='trace')
335+
tester.info('done')

0 commit comments

Comments
 (0)