擅长:python、mysql、java
<p>您可以尝试使用以下格式调用<code>basicConfig</code>:</p>
<pre><code>logging.basicConfig(filename='example.log', filemode='w', format='%(created)f %(message)s', level=logging.INFO)
</code></pre>
<p>这将生成以下日志条目(您的时间将明显不同):</p>
^{pr2}$
<p>我从你的问题推断出,你将在之后解析日志文件来计算持续时间。<code>%(created)f</code>产生自epoch以来经过的秒数作为浮点值,因此希望这将有助于您的计算。在</p>