Coverage for django_log_lens / __init__.py: 100%

5 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-03-15 19:39 +0000

1from .views import file_handlers 

2 

3LEVEL_PREFIX = "[LVL:%(levelno)d]" 

4LOG_FORMAT = LEVEL_PREFIX + "%(asctime)s %(levelname)s: %(message)s" 

5 

6 

7def add_handler(handler_fqcn: str) -> None: 

8 """ 

9 Adds a file handler so that it can be used in the Django Log Lens app. 

10 This only necessary if you want to use handlers different from the default ones 

11 which are `logging.FileHandler`, `logging.handlers.RotatingFileHandler`, 

12 `logging.handlers.TimedRotatingFileHandler`, and `logging.handlers.WatchedFileHandler`. 

13 The handler is identified by its fully qualified class name. 

14 

15 Example: 

16 >>> add_handler("myapp.handlers.MyFileHandler") 

17 """ 

18 file_handlers.add(handler_fqcn)