|
1 .. _debug-toolbar_pyramid: |
|
2 |
|
3 The pyramid debug toolbar |
|
4 ========================= |
|
5 |
|
6 The pyramid webserver comes with an integrated `debug toolbar |
|
7 <https://docs.pylonsproject.org/projects/pyramid_debugtoolbar/>`_ that offers a |
|
8 lot of information to ease development. To ease the development process in |
|
9 CubicWeb a series of custom debug panels have been developped especially for |
|
10 that purpose. |
|
11 |
|
12 To use the pyramid debug toolbar in CubicWeb, you need to: |
|
13 |
|
14 * install it either by doing a `pip install pyramid_debugtoobar` or following |
|
15 `the official installation instructions |
|
16 <https://docs.pylonsproject.org/projects/pyramid_debugtoolbar/#installation>`_ |
|
17 * launch the pyramid command adding the `-t/--toolbar` argument to enable it |
|
18 like so: `cubicweb-ctl pyramid my_instance -t` (you probably want to add `-D` |
|
19 to activate the debug mode during development) |
|
20 * navigate to the website and click on the icon on the right like on this screenshot: |
|
21 |
|
22 .. image:: ../../images/debug_toolbar_icon.png |
|
23 |
|
24 And you'll have access to the debug toolbar content for this page. |
|
25 |
|
26 Custom panels |
|
27 ------------- |
|
28 |
|
29 A series of custom debug panels have been written to offer more useful debug |
|
30 information during development. Here is the list: |
|
31 |
|
32 General 'CubicWeb' Panel |
|
33 ~~~~~~~~~~~~~~~~~~~~~~~~ |
|
34 |
|
35 Provides: |
|
36 |
|
37 * currently selected controller for this with and uri/requests information |
|
38 * current instance configuration, options that differs from default ones are in bold |
|
39 * a list of useful links like on the default CW home |
|
40 |
|
41 Screenshot: |
|
42 |
|
43 .. image:: ../../images/debugtoolbar_general_panel.png |
|
44 |
|
45 Registry Decisions Panel |
|
46 ~~~~~~~~~~~~~~~~~~~~~~~~ |
|
47 |
|
48 Provides: |
|
49 |
|
50 * a list of all decisions taken in all registry during this page construction |
|
51 * the arguments given to take the decision |
|
52 * all the selection entities during decisions with their score |
|
53 * which one has won if any |
|
54 |
|
55 .. image:: ../../images/debugtoolbar_registry_decisions_panel.png |
|
56 |
|
57 Registry Store |
|
58 ~~~~~~~~~~~~~~ |
|
59 |
|
60 Provides: |
|
61 |
|
62 * a listing of all the content of the different registries |
|
63 * for each entity its detailed information |
|
64 |
|
65 .. image:: ../../images/debugtoolbar_registry_content_panel.png |
|
66 |
|
67 RQL |
|
68 ~~~ |
|
69 |
|
70 Provides: |
|
71 |
|
72 * a list of all executed RQL queries during this page creation |
|
73 * for each RQL query all the generated SQL queries |
|
74 * detail information like the result, the args and the description of each query |
|
75 * the call stack on each query to see where it has been called |
|
76 |
|
77 .. image:: ../../images/debugtoolbar_rql_panel.png |
|
78 |
|
79 .. image:: ../../images/debugtoolbar_rql_traceback_panel.png |
|
80 |
|
81 SQL |
|
82 ~~~ |
|
83 |
|
84 Provides: |
|
85 |
|
86 * a list of all executed SQL queries during this page creation |
|
87 * for each SQL query the RQL query that has generated it, if any (some aren't) |
|
88 * detail information like the result, the args and if the query has rollback |
|
89 * the call stack on each query to see where it has been called |
|
90 |
|
91 .. image:: ../../images/debugtoolbar_sql_panel.png |
|
92 |
|
93 Accessing the sources of the class/functions/method listing the debug panels |
|
94 ---------------------------------------------------------------------------- |
|
95 |
|
96 A traversal of all those custom panels is the see the source code of all |
|
97 listing class/functions/methods. You can access those by: |
|
98 |
|
99 * clicking on the `[source]` close to the target when available |
|
100 * clicking on the file path in the traceback stack |
|
101 |
|
102 .. image:: ../../images/debugtoolbar_show_source_link.png |
|
103 .. image:: ../../images/debugtoolbar_traceback_source_link.png |
|
104 |
|
105 You be sent to a page looking like this: |
|
106 |
|
107 .. image:: ../../images/debugtoolbar_show_source.png |
|
108 |
|
109 Contributing |
|
110 ------------ |
|
111 |
|
112 All source code for the custom panels is located `here |
|
113 <https://hg.logilab.org/master/cubicweb/file/tip/cubicweb/pyramid/debugtoolbar_panels.py>`_ |
|
114 and the documentation of how to write `custom toolbar panels here |
|
115 <https://docs.pylonsproject.org/projects/pyramid_debugtoolbar/en/latest/#adding-custom-panels>`_. |