Coverage for src/lcdoc/log.py: 74.81%

Shortcuts on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

90 statements  

1import json lppytest

2import os lppytest

3import sys lppytest

4import time lppytest

5 

6from pygments import highlight lppytest

7from pygments.lexers import JsonLexer lppytest

8 

9from lcdoc.const import LogStats, PageStats, Stats, now_ms, t0 lppytest

10 

11now = time.time lppytest

12 

13B = lambda s: '\x1b[1m%s\x1b[0m' % s lplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdlp|task_runner.mdpytest

14V = lambda s: '\x1b[2m%s\x1b[0m' % s 14 ↛ exitline 14 didn't run the lambda on line 14lppytest

15L = lambda s: '\x1b[2;38;5;245m%s\x1b[0m' % s lplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdlp|task_runner.mdpytest

16M = K = B lppytest

17 

18 

19try: lppytest

20 from pygments.formatters import Terminal256Formatter lppytest

21except: 

22 from pygments.formatters.terminal import TerminalFormatter 

23 

24 Terminal256Formatter = TerminalFormatter 

25 

26 

27# ready to make partials for changing the defaults: 

28def coljhighlight( 

29 s, 

30 style=None, 

31 indent=4, 

32 sort_keys=True, 

33 add_line_seps=True, 

34 # logger might be set to colors off, e.g. at no tty dest: 

35 colorize=True, 

36 # automatic indent only for long stuff? 

37 no_indent_len=0, 

38 jsl=[0], 

39): 

40 if not jsl[0]: lplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|task_runner.md

41 jsl[0] = JsonLexer() lp

42 if not isinstance(s, str): 42 ↛ 65line 42 didn't jump to line 65, because the condition on line 42 was never falselplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|task_runner.md

43 if indent and no_indent_len: 43 ↛ 44line 43 didn't jump to line 44, because the condition on line 43 was never truelplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|task_runner.md

44 if len(str(s)) < no_indent_len: 

45 indent = None 

46 try: lplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|task_runner.md

47 s = json.dumps(s, indent=indent, sort_keys=sort_keys, default=str) lplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|task_runner.md

48 except Exception: 

49 try: 

50 # the sort may fail: TypeError: '<' not supported between instances of 'int' and 'str' 

51 s = json.dumps(s, indent=indent, default=str) 

52 except Exception: 

53 from lcdoc.tools import flatten 

54 

55 return coljhighlight( 

56 flatten(s, sep='.', tpljoin='_'), 

57 style=style, 

58 indent=indent, 

59 sort_keys=sort_keys, 

60 add_line_seps=add_line_seps, 

61 colorize=colorize, 

62 no_indent_len=no_indent_len, 

63 ) 

64 

65 if colorize: 65 ↛ 71line 65 didn't jump to line 71, because the condition on line 65 was never falselplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|task_runner.md

66 # we may be called by structlog, then with style (from 

67 # FLG.log_dev_coljson_style) 

68 # or direct 

69 res = highlight(s, jsl[0], Terminal256Formatter()) lplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|task_runner.md

70 else: 

71 res = s 

72 

73 if add_line_seps: 73 ↛ 76line 73 didn't jump to line 76, because the condition on line 73 was never falselplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|task_runner.md

74 res = res.replace('\\n', '\n') lplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|task_runner.md

75 

76 return res lplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|task_runner.md

77 

78 

79def tokw(kw): lppytest

80 n = app.name lplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdlp|task_runner.mdpytest

81 n = (L(' [%s] ' % n)) if n else '' lplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdlp|task_runner.mdpytest

82 j = kw.pop('json', 0) lplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdlp|task_runner.mdpytest

83 m = ' '.join(['%s:%s' % (L(str(k)), B(str(v))) for k, v in kw.items()]) lplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdlp|task_runner.mdpytest

84 m += (n + '\n' + coljhighlight(j)) if j else n lplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdlp|task_runner.mdpytest

85 return m lplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdlp|task_runner.mdpytest

86 

87 

88ign_errors = os.environ.get('ignore_err', '').split('::') lppytest

89 

90 

91def log(level_name, meth, msg, kw, _err_levels={'error', 'fatal', 'die'}): lppytest

92 if ign_errors and level_name in _err_levels: 92 ↛ 93line 92 didn't jump to line 93, because the condition on line 92 was never truelplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdlp|task_runner.mdpytest

93 if any([p for p in ign_errors if p in msg]): 

94 return app.warning('Ignored Err, level %s' % level_name, orig_msg=msg, kw=kw) 

95 store = log_majors[level_name] lplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdlp|task_runner.mdpytest

96 dt = now_ms() - t0[0] lplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdlp|task_runner.mdpytest

97 if store is not None: 97 ↛ 99line 97 didn't jump to line 99, because the condition on line 97 was never falselplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdlp|task_runner.mdpytest

98 store.append([dt, app.name, msg, kw]) lplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdlp|task_runner.mdpytest

99 app.log_stats[level_name] += 1 lplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdlp|task_runner.mdpytest

100 meth(B(msg + ' ') + tokw(kw)) lplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdlp|task_runner.mdpytest

101 

102 

103log_levels = ['debug', 'info', 'warning', 'error', 'fatal'] lppytest

104log_majors = {k: [] if k[:3] not in ['deb', 'inf'] else [] for k in log_levels} lppytest

105level_by_name = {n: (i + 1) * 10 for n, i in zip(log_levels, range(len(log_levels)))} lppytest

106 

107 

108class app: lppytest

109 """ 

110 Provider of app.info, app.die, ... 

111 

112 """ 

113 

114 name = None lppytest

115 level = 20 lppytest

116 log_stats = LogStats lppytest

117 

118 def die(msg, **kw): lppytest

119 outputter[0] = print 

120 app.fatal(msg, **kw) 

121 sys.exit(1) 

122 

123 def setup_logging(logging_system, name=None, c=[0]): lppytest

124 app.name = name if name is not None else app.name lppytest

125 try: lppytest

126 # only one logging system => only once: 

127 if c[0]: lppytest

128 return lp

129 ls = p = logging_system lppytest

130 for lm in log_levels: lppytest

131 h = getattr(ls, lm) lppytest

132 setattr(app, lm, lambda msg, lm=lm, h=h, **kw: log(lm, h, msg, kw)) lplp|about/changelog.mdlp|about/coverage.mdlp|about/credits.mdlp|about/navigation.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdlp|task_runner.mdpytest

133 try: lppytest

134 while not p.handlers: lppytest

135 p = p.parent lppytest

136 except Exception as ex: 

137 app.level = 20 

138 return 

139 app.level = p.handlers[0].level lppytest

140 finally: 

141 c[0] = True lppytest

142 

143 

144for lm in log_levels: lppytest

145 setattr(app, lm, lambda msg, lm=lm, **kw: log(lm, printout, ('[%s] ' % lm) + msg, kw)) 145 ↛ exitline 145 didn't run the lambda on line 145lppytest

146 app.log_stats[lm] = 0 lppytest

147 

148 

149def printout(msg): lppytest

150 outputter[0](msg) 

151 

152 

153outputter = [print] lppytest