@@ -19,16 +19,18 @@ while logging various metadata, statistics, and trace information. Any time
19
19
you're tempted to write your own wrapper around things like
20
20
:class: `subprocess.Popen ` or :func: `subprocess.run `, consider using
21
21
:func: `ShellLogger.log ` instead. If you're familiar with `the Unix script
22
- command <https://man7.org/linux/man-pages/man1/script.1.html> `_, this is
23
- similar in principle, but with substantially more functionality. If you're
24
- familiar with `Python's logging module
25
- <https://docs.python.org/3/library/logging.html> `_, the motivation is similar,
26
- but this intends to capture what's happening *in the shell * rather than in
27
- Python itself.
22
+ command `_, this is similar in principle, but with substantially more
23
+ functionality. If you're familiar with `Python's logging module `_, the
24
+ motivation is similar, but this intends to capture what's happening *in the
25
+ shell * rather than in Python itself.
28
26
29
- The following talk from the `US-RSE Virtual Workshop 2021
30
- <https://us-rse.org/virtual-workshop-2021/> `_ illustrates the module's
31
- functionality.
27
+ .. _the Unix script command : https://man7.org/linux/man-pages/man1/script.1.html
28
+ .. _Python's logging module : https://docs.python.org/3/library/logging.html
29
+
30
+ The following talk from the `US-RSE Virtual Workshop 2021 `_ illustrates the
31
+ module's functionality.
32
+
33
+ .. _US-RSE Virtual Workshop 2021 : https://us-rse.org/virtual-workshop-2021/
32
34
33
35
.. raw :: html
34
36
@@ -53,11 +55,12 @@ functionality.
53
55
Where to Get shell-logger
54
56
-------------------------
55
57
56
- The source repository for this module can be found `here
57
- <https://internal.gitlab.server/ShellLogger/ShellLogger> `_. See the project's
58
- `README.md
59
- <https://internal.gitlab.server/ShellLogger/ShellLogger/-/blob/master/README.md> `_
60
- for details on how to clone, install, and otherwise interact with the project.
58
+ The source repository for this module can be found `on GitHub `_. See the
59
+ project's `README `_ for details on how to clone, install, and otherwise
60
+ interact with the project.
61
+
62
+ .. _on GitHub : https://github.com/sandialabs/shell-logger
63
+ .. _README : https://github.com/sandialabs/shell-logger/blob/master/README.md
61
64
62
65
Using shell-logger
63
66
------------------
@@ -105,17 +108,16 @@ the following:
105
108
.. literalinclude :: ../../example/hello_world_html.py
106
109
:language: python
107
110
:linenos:
111
+ :lines: 11-
108
112
:caption: ``example/hello_world_html.py ``
109
113
110
114
Running the script yields
111
115
112
116
.. code-block ::
113
117
114
118
This example demonstrates logging information solely to the HTML log file.
115
- Open /Users/jmgate/workspace/shell-logger/ example/log_hello_world_html/2021-09-22_14.56.42.558599_szt68acx /Hello_ShellLogger.html to view the log.
119
+ Open <path-to- example-dir> /log_hello_world_html/<timestamp>_<unique-str> /Hello_ShellLogger.html to view the log.
116
120
117
- You can view the generated HTML log file `here
118
- <http://shelllogger.internal.gitlab.pages/shell-logger/example/Hello_World_HTML.html> `__.
119
121
When you open that file, you'll see something like
120
122
121
123
.. image :: images/html_log.png
@@ -175,12 +177,10 @@ highlighted lines below.
175
177
.. literalinclude :: ../../example/hello_world_html_and_console.py
176
178
:language: python
177
179
:linenos:
178
- :emphasize-lines: 11, 13
180
+ :lines: 11-
181
+ :emphasize-lines: 15-16, 22-23
179
182
:caption: ``example/hello_world_html_and_console.py ``
180
183
181
- You can view the generated HTML log file `here
182
- <http://shelllogger.internal.gitlab.pages/shell-logger/example/Hello_World_HTML_and_Console.html> `__.
183
-
184
184
Example 3: Collecting Statistics
185
185
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
186
186
@@ -191,12 +191,10 @@ and **Example 1** are the highlighted lines below.
191
191
.. literalinclude :: ../../example/hello_world_html_with_stats.py
192
192
:language: python
193
193
:linenos:
194
- :emphasize-lines: 12, 14
194
+ :lines: 11-
195
+ :emphasize-lines: 16, 22
195
196
:caption: ``example/hello_world_html_with_stats.py ``
196
197
197
- You can view the generated HTML log file `here
198
- <http://shelllogger.internal.gitlab.pages/shell-logger/example/Hello_World_HTML_with_Stats.html> `__.
199
-
200
198
Example 4: Building a Code
201
199
^^^^^^^^^^^^^^^^^^^^^^^^^^^
202
200
@@ -215,11 +213,9 @@ The equivalent Python script using ``shell-logger`` is the following:
215
213
.. literalinclude :: ../../example/build_flex.py
216
214
:language: python
217
215
:linenos:
216
+ :lines: 11-
218
217
:caption: ``example/build_flex.py ``
219
218
220
- You can view the generated HTML log file `here
221
- <http://shelllogger.internal.gitlab.pages/shell-logger/example/Build_Flex.html> `__.
222
-
223
219
More Details
224
220
------------
225
221
0 commit comments