bt.logging

Logging Reference Documentation


Introduction

The Logging interfaces with bittensor internal logging system.

Examples

1import bittensor as bt
2
3# Turn on debug logs
4bt.debug()
5
6# Turn on trace logs
7bt.trace()
8
9# Turn off debug logs
10bt.set_debug(False)
11
12# Turn off trace logs
13bt.set_trace(False)
14
15# Turn on logging from class definition
16bt.logging( set_debug = True )
17
18# Instantiate logging from command line args
19bt.logging( bt.logging.config() )
20
21# Turn on logging to file
22bt.logging( record_log = True, logging_dir = '/path/to/logs/' )
23
24# Log
25bt.logging.info(message)
26bt.logging.debug(message)
27bt.logging.trace(message)
28bt.logging.success(message)
29bt.logging.critical(message)
30bt.logging.error(message)
31>>> 2023-05-29 09:27:25.426 |       INFO       | message                           
32
33# Log using prefex suffix design
34bt.logging.info(prefix, message)
35bt.logging.debug(prefix, message)
36bt.logging.trace(prefix, message)
37bt.logging.success(prefix, message)
38bt.logging.critical(prefix, message)
39bt.logging.error(prefix, message)
40>>> 2023-05-29 09:27:47.184 |       INFO       | cat                           dogs