File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed
docusaurus/docs/Advanced Concepts Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ id : logging-configuration
3+ title : Logging Configuration
4+ ---
5+
6+ # Logging configuration
7+ The following code snippet shows how to setup a baseline configuration for logging in your application.
8+
9+ :::info Multiple orders mismatch
10+ We didn't want to introduce a custom logging configuration when creating the framework,
11+ so we use the default logging configuration of Python. The code snippet below shows how to configure the logging
12+ through Python's standard logging configuration. You can use this as a baseline configuration for your application.
13+ :::
14+
15+
16+ > Notice the explicit logger for the investing_algorithm_framework package. This is required to ensure
17+ that the framework logs are not suppressed by the root logger. You can change the logging level to
18+ ` logging.DEBUG ` to see more detailed logs.
19+
20+ ``` python
21+ import logging.config
22+ config = {
23+ ' version' : 1 ,
24+ ' disable_existing_loggers' : True ,
25+ ' formatters' : {
26+ ' standard' : {
27+ ' format' : ' %(asctime)s [%(levelname)s ] %(name)s : %(message)s '
28+ },
29+ },
30+ ' handlers' : {
31+ ' default' : {
32+ ' level' : ' INFO' ,
33+ ' formatter' : ' standard' ,
34+ ' class' : ' logging.StreamHandler' ,
35+ ' stream' : ' ext://sys.stdout' , # Default is stderr
36+ },
37+ },
38+ ' loggers' : {
39+ ' ' : { # root logger
40+ ' handlers' : [' default' ],
41+ ' level' : ' WARNING' ,
42+ ' propagate' : False
43+ },
44+ ' investing_algorithm_framework' : {
45+ ' level' : ' INFO' , # Set the desired root log level
46+ ' handlers' : [' default' ],
47+ ' propagate' : False
48+ }
49+ },
50+ }
51+ logging.config.dictConfig(config)
52+ ```
53+
You can’t perform that action at this time.
0 commit comments