Skip to content

Commit 758cd25

Browse files
committed
feat: configure logging settings with dynamic log level based on environment variable
Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
1 parent 30fc47e commit 758cd25

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

docker/netbox/configuration/logging.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
from os import environ
2+
3+
LOGGING = {
4+
'version': 1,
5+
'disable_existing_loggers': False,
6+
'handlers': {
7+
'console': {
8+
'class': 'logging.StreamHandler',
9+
},
10+
},
11+
'loggers': {
12+
'': { # root logger
13+
'handlers': ['console'],
14+
'level': 'DEBUG' if environ.get('DEBUG', 'false').lower() == 'true' else 'INFO',
15+
},
16+
},
17+
}
18+
119
# # Remove first comment(#) on each line to implement this working logging example.
220
# # Add LOGLEVEL environment variable to netbox if you use this example & want a different log level.
321
# from os import environ

0 commit comments

Comments
 (0)