<spanid="evennia-utils-logger"></span><h1>evennia.utils.logger<aclass="headerlink"href="#module-evennia.utils.logger"title="Permalink to this headline">¶</a></h1>
<p>Logging facilities</p>
<p>These are thin wrappers on top of Twisted’s logging facilities; logs
are all directed either to stdout (if Evennia is running in
interactive mode) or to $GAME_DIR/server/logs.</p>
<p>The log_file() function uses its own threading system to log to
arbitrary files in $GAME_DIR/server/logs.</p>
<p>Note: All logging functions have two aliases, log_type() and
log_typemsg(). This is for historical, back-compatible reasons.</p>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">log_info</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/logger.html#log_info"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.log_info"title="Permalink to this definition">¶</a></dt>
<dd><p>Logs any generic debugging/informative info that should appear in the log.</p>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">info</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#evennia.utils.logger.info"title="Permalink to this definition">¶</a></dt>
<dd><p>Logs any generic debugging/informative info that should appear in the log.</p>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">log_infomsg</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#evennia.utils.logger.log_infomsg"title="Permalink to this definition">¶</a></dt>
<dd><p>Logs any generic debugging/informative info that should appear in the log.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>msg</strong>– (string) The message to be logged.</p></li>
<li><p><strong>**kwargs</strong>– If given, The <strong>msg</strong> is parsed as a format string with <strong>{..}</strong>
formatting markers that should match the keywords.</p></li>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">log_msg</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#evennia.utils.logger.log_msg"title="Permalink to this definition">¶</a></dt>
<dd><p>Logs any generic debugging/informative info that should appear in the log.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>msg</strong>– (string) The message to be logged.</p></li>
<li><p><strong>**kwargs</strong>– If given, The <strong>msg</strong> is parsed as a format string with <strong>{..}</strong>
formatting markers that should match the keywords.</p></li>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">log_warn</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/logger.html#log_warn"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.log_warn"title="Permalink to this definition">¶</a></dt>
<dd><p>Logs warnings that aren’t critical but should be noted.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>msg</strong> (<em>str</em>) – The message to be logged.</p></li>
<li><p><strong>**kwargs</strong>– If given, The <strong>msg</strong> is parsed as a format string with <strong>{..}</strong>
formatting markers that should match the keywords.</p></li>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">warn</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#evennia.utils.logger.warn"title="Permalink to this definition">¶</a></dt>
<dd><p>Logs warnings that aren’t critical but should be noted.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>msg</strong> (<em>str</em>) – The message to be logged.</p></li>
<li><p><strong>**kwargs</strong>– If given, The <strong>msg</strong> is parsed as a format string with <strong>{..}</strong>
formatting markers that should match the keywords.</p></li>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">warning</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#evennia.utils.logger.warning"title="Permalink to this definition">¶</a></dt>
<dd><p>Logs warnings that aren’t critical but should be noted.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>msg</strong> (<em>str</em>) – The message to be logged.</p></li>
<li><p><strong>**kwargs</strong>– If given, The <strong>msg</strong> is parsed as a format string with <strong>{..}</strong>
formatting markers that should match the keywords.</p></li>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">log_warnmsg</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#evennia.utils.logger.log_warnmsg"title="Permalink to this definition">¶</a></dt>
<dd><p>Logs warnings that aren’t critical but should be noted.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>msg</strong> (<em>str</em>) – The message to be logged.</p></li>
<li><p><strong>**kwargs</strong>– If given, The <strong>msg</strong> is parsed as a format string with <strong>{..}</strong>
formatting markers that should match the keywords.</p></li>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">log_err</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/logger.html#log_err"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.log_err"title="Permalink to this definition">¶</a></dt>
<dd><p>Logs an error message to the server log.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>msg</strong> (<em>str</em>) – The message to be logged.</p></li>
<li><p><strong>**kwargs</strong>– If given, The <strong>msg</strong> is parsed as a format string with <strong>{..}</strong>
formatting markers that should match the keywords.</p></li>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">error</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#evennia.utils.logger.error"title="Permalink to this definition">¶</a></dt>
<dd><p>Logs an error message to the server log.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>msg</strong> (<em>str</em>) – The message to be logged.</p></li>
<li><p><strong>**kwargs</strong>– If given, The <strong>msg</strong> is parsed as a format string with <strong>{..}</strong>
formatting markers that should match the keywords.</p></li>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">err</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#evennia.utils.logger.err"title="Permalink to this definition">¶</a></dt>
<dd><p>Logs an error message to the server log.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>msg</strong> (<em>str</em>) – The message to be logged.</p></li>
<li><p><strong>**kwargs</strong>– If given, The <strong>msg</strong> is parsed as a format string with <strong>{..}</strong>
formatting markers that should match the keywords.</p></li>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">log_errmsg</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#evennia.utils.logger.log_errmsg"title="Permalink to this definition">¶</a></dt>
<dd><p>Logs an error message to the server log.</p>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">log_trace</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/logger.html#log_trace"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.log_trace"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">log_tracemsg</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#evennia.utils.logger.log_tracemsg"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">exception</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#evennia.utils.logger.exception"title="Permalink to this definition">¶</a></dt>
<dd><p>Log a traceback to the log. This should be called from within an
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">critical</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#evennia.utils.logger.critical"title="Permalink to this definition">¶</a></dt>
<dd><p>Log a traceback to the log. This should be called from within an
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">trace</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#evennia.utils.logger.trace"title="Permalink to this definition">¶</a></dt>
<dd><p>Log a traceback to the log. This should be called from within an
exception.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>msg</strong> (<em>str</em><em>, </em><em>optional</em>) – Adds an extra line with added info
at the end of the traceback in the log.</p></li>
<li><p><strong>**kwargs</strong>– If given, The <strong>msg</strong> is parsed as a format string with <strong>{..}</strong>
formatting markers that should match the keywords.</p></li>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">log_dep</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/logger.html#log_dep"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.log_dep"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">dep</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#evennia.utils.logger.dep"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">deprecated</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#evennia.utils.logger.deprecated"title="Permalink to this definition">¶</a></dt>
<dd><p>Prints a deprecation message.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>msg</strong> (<em>str</em>) – The deprecation message to log.</p></li>
<li><p><strong>**kwargs</strong>– If given, The <strong>msg</strong> is parsed as a format string with <strong>{..}</strong>
formatting markers that should match the keywords.</p></li>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">log_depmsg</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#evennia.utils.logger.log_depmsg"title="Permalink to this definition">¶</a></dt>
<dd><p>Prints a deprecation message.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>msg</strong> (<em>str</em>) – The deprecation message to log.</p></li>
<li><p><strong>**kwargs</strong>– If given, The <strong>msg</strong> is parsed as a format string with <strong>{..}</strong>
formatting markers that should match the keywords.</p></li>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">log_sec</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/logger.html#log_sec"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.log_sec"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">sec</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#evennia.utils.logger.sec"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">security</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#evennia.utils.logger.security"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">log_secmsg</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#evennia.utils.logger.log_secmsg"title="Permalink to this definition">¶</a></dt>
<li><p><strong>msg</strong> (<em>str</em>) – The security message to log.</p></li>
<li><p><strong>**kwargs</strong>– If given, The <strong>msg</strong> is parsed as a format string with <strong>{..}</strong>
formatting markers that should match the keywords.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="py function">
<dtid="evennia.utils.logger.log_server">
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">log_server</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/logger.html#log_server"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.log_server"title="Permalink to this definition">¶</a></dt>
<dd><p>This is for the Portal to log captured Server stdout messages (it’s
usually only used during startup, before Server log is open)</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>msg</strong> (<em>str</em>) – The message to be logged.</p></li>
<li><p><strong>**kwargs</strong>– If given, The <strong>msg</strong> is parsed as a format string with <strong>{..}</strong>
formatting markers that should match the keywords.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="py class">
<dtid="evennia.utils.logger.GetLogObserver">
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">GetLogObserver</code><aclass="reference internal"href="../_modules/evennia/utils/logger.html#GetLogObserver"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.GetLogObserver"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">component_prefix</code><emclass="property"> = ''</em><aclass="headerlink"href="#evennia.utils.logger.GetLogObserver.component_prefix"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">format_log_event</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">event</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/logger.html#GetLogObserver.format_log_event"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.GetLogObserver.format_log_event"title="Permalink to this definition">¶</a></dt>
<dd><p>By assigning log_system here, we skip the spammy display of namespace/level
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">GetPortalLogObserver</code><aclass="reference internal"href="../_modules/evennia/utils/logger.html#GetPortalLogObserver"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.GetPortalLogObserver"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">component_prefix</code><emclass="property"> = '|Portal| '</em><aclass="headerlink"href="#evennia.utils.logger.GetPortalLogObserver.component_prefix"title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">GetServerLogObserver</code><aclass="reference internal"href="../_modules/evennia/utils/logger.html#GetServerLogObserver"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.GetServerLogObserver"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">component_prefix</code><emclass="property"> = ''</em><aclass="headerlink"href="#evennia.utils.logger.GetServerLogObserver.component_prefix"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="py function">
<dtid="evennia.utils.logger.timeformat">
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">timeformat</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">when</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/logger.html#timeformat"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.timeformat"title="Permalink to this definition">¶</a></dt>
<dd><p>This helper function will format the current time in the same
way as the twisted logger does, including time zone info. Only
difference from official logger is that we only use two digits
for the year and don’t show timezone for GMT times.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>when</strong> (<em>int</em><em>, </em><em>optional</em>) – This is a time in POSIX seconds on the form
given by time.time(). If not given, this function will
use the current time.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>timestring (str)</em>– A formatted string of the given time.</p>
<codeclass="sig-name descname">__init__</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">name</span></em>, <emclass="sig-param"><spanclass="n">directory</span></em>, <emclass="sig-param"><spanclass="n">defaultMode</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">day_rotation</span><spanclass="o">=</span><spanclass="default_value">7</span></em>, <emclass="sig-param"><spanclass="n">max_size</span><spanclass="o">=</span><spanclass="default_value">1000000</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/logger.html#WeeklyLogFile.__init__"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.WeeklyLogFile.__init__"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>name</strong> (<em>str</em>) – Name of log file.</p></li>
<li><p><strong>directory</strong> (<em>str</em>) – Directory holding the file.</p></li>
<li><p><strong>defaultMode</strong> (<em>str</em>) – Permissions used to create file. Defaults to
current permissions of this file if it exists.</p></li>
<li><p><strong>day_rotation</strong> (<em>int</em>) – How often to rotate the file.</p></li>
<li><p><strong>max_size</strong> (<em>int</em>) – Max size of log file before rotation (regardless of
<codeclass="sig-name descname">shouldRotate</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/logger.html#WeeklyLogFile.shouldRotate"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.WeeklyLogFile.shouldRotate"title="Permalink to this definition">¶</a></dt>
<dd><p>Rotate when the date has changed since last write</p>
<codeclass="sig-name descname">suffix</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">tupledate</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/logger.html#WeeklyLogFile.suffix"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.WeeklyLogFile.suffix"title="Permalink to this definition">¶</a></dt>
<dd><p>Return the suffix given a (year, month, day) tuple or unixtime.
Format changed to have 03 for march instead of 3 etc (retaining unix
file order)</p>
<p>If we get duplicate suffixes in location (due to hitting size limit),
we append __1, __2 etc.</p>
<pclass="rubric">Examples</p>
<p>server.log.2020_01_29
server.log.2020_01_29__1
server.log.2020_01_29__2</p>
</dd></dl>
<dlclass="py method">
<dtid="evennia.utils.logger.WeeklyLogFile.write">
<codeclass="sig-name descname">write</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">data</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/logger.html#WeeklyLogFile.write"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.WeeklyLogFile.write"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">settings</code><emclass="property"> = <LazySettings "evennia.settings_default"></em><aclass="headerlink"href="#evennia.utils.logger.EvenniaLogFile.settings"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">num_lines_to_append</code><emclass="property"> = 20</em><aclass="headerlink"href="#evennia.utils.logger.EvenniaLogFile.num_lines_to_append"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">rotate</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">num_lines_to_append</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/logger.html#EvenniaLogFile.rotate"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.EvenniaLogFile.rotate"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">seek</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">*</span><spanclass="n">args</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/logger.html#EvenniaLogFile.seek"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.EvenniaLogFile.seek"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">readlines</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">*</span><spanclass="n">args</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/logger.html#EvenniaLogFile.readlines"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.EvenniaLogFile.readlines"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">log_file</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">msg</span></em>, <emclass="sig-param"><spanclass="n">filename</span><spanclass="o">=</span><spanclass="default_value">'game.log'</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/logger.html#log_file"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.log_file"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">log_file_exists</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">filename</span><spanclass="o">=</span><spanclass="default_value">'game.log'</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/logger.html#log_file_exists"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.log_file_exists"title="Permalink to this definition">¶</a></dt>
<dd><p>Determine if a log-file already exists.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>filename</strong> (<em>str</em>) – The filename (within the log-dir).</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>bool</em>– If the log file exists or not.</p>
</dd>
</dl>
</dd></dl>
<dlclass="py function">
<dtid="evennia.utils.logger.rotate_log_file">
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">rotate_log_file</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">filename</span><spanclass="o">=</span><spanclass="default_value">'game.log'</span></em>, <emclass="sig-param"><spanclass="n">num_lines_to_append</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/logger.html#rotate_log_file"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.rotate_log_file"title="Permalink to this definition">¶</a></dt>
<dd><p>Force-rotate a log-file, without</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>filename</strong> (<em>str</em>) – The log file, located in settings.LOG_DIR.</p></li>
<li><p><strong>num_lines_to_append</strong> (<em>int</em><em>, </em><em>optional</em>) – Include N number of
lines from previous file in new one. If <strong>None</strong>, use default.
<codeclass="sig-prename descclassname">evennia.utils.logger.</code><codeclass="sig-name descname">tail_log_file</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">filename</span></em>, <emclass="sig-param"><spanclass="n">offset</span></em>, <emclass="sig-param"><spanclass="n">nlines</span></em>, <emclass="sig-param"><spanclass="n">callback</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/utils/logger.html#tail_log_file"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.utils.logger.tail_log_file"title="Permalink to this definition">¶</a></dt>
<li><p><strong>filename</strong> (<em>str</em>) – The name of the log file, presumed to be in
the Evennia log dir.</p></li>
<li><p><strong>offset</strong> (<em>int</em>) – The line offset <em>from the end of the file</em> to start
reading from. 0 means to start at the latest entry.</p></li>
<li><p><strong>nlines</strong> (<em>int</em>) – How many lines to return, counting backwards
from the offset. If file is shorter, will get all lines.</p></li>
<li><p><strong>callback</strong> (<em>callable</em><em>, </em><em>optional</em>) – A function to manage the result of the
asynchronous file access. This will get a list of lines. If unset,
the tail will happen synchronously.</p></li>
</ul>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><p><em>lines (deferred or list)</em>–</p>
<dlclass="simple">
<dt>This will be a deferred if <strong>callable</strong> is given,</dt><dd><p>otherwise it will be a list with The nline entries from the end of the file, or