Skip to content

Commit bf9d8d8

Browse files
author
github-actions
committed
Docs build 2025-04-07
1 parent 435fa50 commit bf9d8d8

File tree

6 files changed

+70
-2
lines changed

6 files changed

+70
-2
lines changed

en/latest/_sources/using-operations.rst.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,24 @@ pyinfra doesn't immediately execute operations, meaning output is not available
207207
)
208208
209209
210+
There is also the possibility to use pyinfra's logging functionality which may be appropriate in certain situations.
211+
212+
.. code:: python
213+
214+
from pyinfra import logger
215+
def ufw_usable(function code here)
216+
is_ufw_usable = ufw_usable()
217+
logger.info('Checking output of ufw_usable: {}'.format(is_ufw_usable))
218+
219+
220+
Produces output similar to:
221+
--> Preparing Operations...
222+
Loading: deploy_create_users.py
223+
Checking output of ufw_usable: None
224+
[multitest.example.com] Ready: deploy_create_users.py
225+
226+
227+
210228
Nested Operations
211229
-----------------
212230

en/latest/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

en/latest/using-operations.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,22 @@ <h3>Operation Output<a class="headerlink" href="#operation-output" title="Link t
333333
<span class="p">)</span>
334334
</pre></div>
335335
</div>
336+
<p>There is also the possibility to use pyinfra’s logging functionality which may be appropriate in certain situations.</p>
337+
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">pyinfra</span> <span class="kn">import</span> <span class="n">logger</span>
338+
<span class="k">def</span> <span class="nf">ufw_usable</span><span class="p">(</span><span class="n">function</span> <span class="n">code</span> <span class="n">here</span><span class="p">)</span>
339+
<span class="n">is_ufw_usable</span> <span class="o">=</span> <span class="n">ufw_usable</span><span class="p">()</span>
340+
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s1">&#39;Checking output of ufw_usable: </span><span class="si">{}</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">is_ufw_usable</span><span class="p">))</span>
341+
</pre></div>
342+
</div>
343+
<dl class="simple">
344+
<dt>Produces output similar to:</dt><dd><dl class="simple">
345+
<dt>–&gt; Preparing Operations…</dt><dd><p>Loading: deploy_create_users.py
346+
Checking output of ufw_usable: None
347+
[multitest.example.com] Ready: deploy_create_users.py</p>
348+
</dd>
349+
</dl>
350+
</dd>
351+
</dl>
336352
</section>
337353
</section>
338354
<section id="nested-operations">

en/next/_sources/using-operations.rst.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,24 @@ pyinfra doesn't immediately execute operations, meaning output is not available
207207
)
208208
209209
210+
There is also the possibility to use pyinfra's logging functionality which may be appropriate in certain situations.
211+
212+
.. code:: python
213+
214+
from pyinfra import logger
215+
def ufw_usable(function code here)
216+
is_ufw_usable = ufw_usable()
217+
logger.info('Checking output of ufw_usable: {}'.format(is_ufw_usable))
218+
219+
220+
Produces output similar to:
221+
--> Preparing Operations...
222+
Loading: deploy_create_users.py
223+
Checking output of ufw_usable: None
224+
[multitest.example.com] Ready: deploy_create_users.py
225+
226+
227+
210228
Nested Operations
211229
-----------------
212230

en/next/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

en/next/using-operations.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,22 @@ <h3>Operation Output<a class="headerlink" href="#operation-output" title="Link t
333333
<span class="p">)</span>
334334
</pre></div>
335335
</div>
336+
<p>There is also the possibility to use pyinfra’s logging functionality which may be appropriate in certain situations.</p>
337+
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">pyinfra</span> <span class="kn">import</span> <span class="n">logger</span>
338+
<span class="k">def</span> <span class="nf">ufw_usable</span><span class="p">(</span><span class="n">function</span> <span class="n">code</span> <span class="n">here</span><span class="p">)</span>
339+
<span class="n">is_ufw_usable</span> <span class="o">=</span> <span class="n">ufw_usable</span><span class="p">()</span>
340+
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s1">&#39;Checking output of ufw_usable: </span><span class="si">{}</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">is_ufw_usable</span><span class="p">))</span>
341+
</pre></div>
342+
</div>
343+
<dl class="simple">
344+
<dt>Produces output similar to:</dt><dd><dl class="simple">
345+
<dt>–&gt; Preparing Operations…</dt><dd><p>Loading: deploy_create_users.py
346+
Checking output of ufw_usable: None
347+
[multitest.example.com] Ready: deploy_create_users.py</p>
348+
</dd>
349+
</dl>
350+
</dd>
351+
</dl>
336352
</section>
337353
</section>
338354
<section id="nested-operations">

0 commit comments

Comments
 (0)