|
3 | 3 | """
|
4 | 4 |
|
5 | 5 | import logging
|
6 |
| - |
7 | 6 | import os
|
8 | 7 | import sys
|
9 |
| -# https://github.com/Delgan/loguru/issues/1012 |
10 |
| -# from loguru import logger |
11 |
| - |
12 |
| -# logging_format = ( |
13 |
| -# "<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | " |
14 |
| -# "<level>{level: <8}</level> | " |
15 |
| -# "<cyan>{file.path}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level>" |
16 |
| -# ) |
17 | 8 |
|
18 | 9 | # logger.remove()
|
19 | 10 | # logger.add(sys.stderr, format=logging_format)
|
|
25 | 16 | from sentry_sdk.integrations.logging import LoggingIntegration
|
26 | 17 | from sentry_sdk.integrations.threading import ThreadingIntegration
|
27 | 18 |
|
| 19 | +# https://github.com/Delgan/loguru/issues/1012 |
| 20 | +# from loguru import logger |
| 21 | + |
| 22 | +# logging_format = ( |
| 23 | +# "<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | " |
| 24 | +# "<level>{level: <8}</level> | " |
| 25 | +# "<cyan>{file.path}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level>" |
| 26 | +# ) |
| 27 | + |
| 28 | + |
| 29 | +# Convert warnings to exceptions for easier debugging |
| 30 | +# import warnings |
| 31 | +# warnings.filterwarnings("error", category=RuntimeWarning) |
| 32 | + |
28 | 33 | env = environ.Env(
|
29 | 34 | # set casting, default value
|
30 | 35 | DEBUG=(bool, False),
|
|
251 | 256 | "format": "{asctime} {levelname} {message}",
|
252 | 257 | "style": "{",
|
253 | 258 | },
|
| 259 | + "verbose": { |
| 260 | + "format": "{levelname} {message} {pathname}:{lineno}", |
| 261 | + "style": "{", |
| 262 | + }, |
254 | 263 | },
|
255 | 264 | "handlers": {
|
256 | 265 | "console": {
|
257 | 266 | # logging handler that outputs log messages to terminal
|
258 | 267 | "class": "logging.StreamHandler",
|
259 | 268 | "level": "DEBUG", # message level to be written to console
|
260 |
| - "formatter": "timestamp", |
| 269 | + "formatter": "verbose", |
261 | 270 | },
|
262 | 271 | },
|
263 | 272 | "loggers": {
|
|
274 | 283 | # django also has database level logging
|
275 | 284 | "level": env("LOGGING_DB_LEVEL")
|
276 | 285 | },
|
| 286 | + "py.warnings": { |
| 287 | + "handlers": ["console"], |
| 288 | + "level": "WARNING", |
| 289 | + "propagate": True, |
| 290 | + }, |
277 | 291 | },
|
278 | 292 | }
|
279 | 293 |
|
|
0 commit comments