Coverage for src/mkdocs_gallery/mkdocs_compatibility.py: 89%

9 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-09-30 08:26 +0000

1# Authors: Sylvain MARIE <sylvain.marie@se.com> 

2# + All contributors to <https://github.com/smarie/mkdocs-gallery> 

3# 

4# Original idea and code: sphinx-gallery, <https://sphinx-gallery.github.io> 

5# License: 3-clause BSD, <https://github.com/smarie/mkdocs-gallery/blob/master/LICENSE> 

6""" 

7Backwards-compatility shims for mkdocs. Only logger is here for now. 

8""" 

9 

10import logging 

11 

12from mkdocs.utils import warning_filter 

13 

14 

15def red(msg): 

16 # TODO investigate how we can do this in mkdocs console 

17 return msg 

18 

19 

20def getLogger(name="mkdocs-gallery"): 

21 """From https://github.com/fralau/mkdocs-mermaid2-plugin/pull/19/.""" 

22 log = logging.getLogger("mkdocs.plugins." + name) 

23 log.addFilter(warning_filter) 

24 

25 # todo what about colors ? currently we remove the argument in each call 

26 

27 # the verbose method does not exist 

28 log.verbose = log.debug 

29 

30 return log 

31 

32 

33# status_iterator = sphinx.util.status_iterator