mirror of
https://github.com/evennia/evennia.git
synced 2026-03-18 05:46:31 +01:00
830 lines
No EOL
55 KiB
HTML
830 lines
No EOL
55 KiB
HTML
|
||
<!DOCTYPE html>
|
||
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||
|
||
<title>evennia.utils.logger — Evennia 3.x documentation</title>
|
||
<link rel="stylesheet" href="../_static/nature.css" type="text/css" />
|
||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
|
||
<script src="../_static/jquery.js"></script>
|
||
<script src="../_static/underscore.js"></script>
|
||
<script src="../_static/doctools.js"></script>
|
||
<script src="../_static/language_data.js"></script>
|
||
<link rel="shortcut icon" href="../_static/favicon.ico"/>
|
||
<link rel="index" title="Index" href="../genindex.html" />
|
||
<link rel="search" title="Search" href="../search.html" />
|
||
<link rel="next" title="evennia.utils.optionclasses" href="evennia.utils.optionclasses.html" />
|
||
<link rel="prev" title="evennia.utils.gametime" href="evennia.utils.gametime.html" />
|
||
</head><body>
|
||
|
||
|
||
<div class="admonition important">
|
||
<p class="first admonition-title">Note</p>
|
||
<p class="last">You are reading an old version of the Evennia documentation. <a href="https://www.evennia.com/docs/latest/index.html">The latest version is here</a></p>.
|
||
</div>
|
||
|
||
|
||
|
||
<div class="related" role="navigation" aria-label="related navigation">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
accesskey="I">index</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="right" >
|
||
<a href="evennia.utils.optionclasses.html" title="evennia.utils.optionclasses"
|
||
accesskey="N">next</a> |</li>
|
||
<li class="right" >
|
||
<a href="evennia.utils.gametime.html" title="evennia.utils.gametime"
|
||
accesskey="P">previous</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../index.html">Evennia 3.x</a> »</li>
|
||
<li class="nav-item nav-item-1"><a href="../Evennia-API.html" >API Summary</a> »</li>
|
||
<li class="nav-item nav-item-2"><a href="evennia-api.html" >evennia</a> »</li>
|
||
<li class="nav-item nav-item-3"><a href="evennia.html" >evennia</a> »</li>
|
||
<li class="nav-item nav-item-4"><a href="evennia.utils.html" accesskey="U">evennia.utils</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">evennia.utils.logger</a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<div class="document">
|
||
|
||
<div class="documentwrapper">
|
||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||
<div class="sphinxsidebarwrapper">
|
||
<p class="logo"><a href="../index.html">
|
||
<img class="logo" src="../_static/evennia_logo.png" alt="Logo"/>
|
||
</a></p>
|
||
<div id="searchbox" style="display: none" role="search">
|
||
<h3 id="searchlabel">Quick search</h3>
|
||
<div class="searchformwrapper">
|
||
<form class="search" action="../search.html" method="get">
|
||
<input type="text" name="q" aria-labelledby="searchlabel" />
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<script>$('#searchbox').show(0);</script>
|
||
<h4>Previous topic</h4>
|
||
<p class="topless"><a href="evennia.utils.gametime.html"
|
||
title="previous chapter">evennia.utils.gametime</a></p>
|
||
<h4>Next topic</h4>
|
||
<p class="topless"><a href="evennia.utils.optionclasses.html"
|
||
title="next chapter">evennia.utils.optionclasses</a></p>
|
||
<div role="note" aria-label="source link">
|
||
<!--h3>This Page</h3-->
|
||
<ul class="this-page-menu">
|
||
<li><a href="../_sources/api/evennia.utils.logger.md.txt"
|
||
rel="nofollow">Show Page Source</a></li>
|
||
</ul>
|
||
</div><h3>Links</h3>
|
||
<ul>
|
||
<li><a href="https://www.evennia.com/docs/latest/index.html">Documentation Top</a> </li>
|
||
<li><a href="https://www.evennia.com">Evennia Home</a> </li>
|
||
<li><a href="https://github.com/evennia/evennia">Github</a> </li>
|
||
<li><a href="http://games.evennia.com">Game Index</a> </li>
|
||
<li>
|
||
<a href="https://discord.gg/AJJpcRUhtF">Discord</a> -
|
||
<a href="https://github.com/evennia/evennia/discussions">Discussions</a> -
|
||
<a href="https://evennia.blogspot.com/">Blog</a>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div class="bodywrapper">
|
||
<div class="body" role="main">
|
||
|
||
<section id="module-evennia.utils.logger">
|
||
<span id="evennia-utils-logger"></span><h1>evennia.utils.logger<a class="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>
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.log_info">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_info</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#log_info"><span class="viewcode-link">[source]</span></a><a class="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>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.info">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">info</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="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>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.log_infomsg">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_infomsg</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="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>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.log_msg">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_msg</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="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>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.log_warn">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_warn</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#log_warn"><span class="viewcode-link">[source]</span></a><a class="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>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.warn">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">warn</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="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>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.warning">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">warning</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="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>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.log_warnmsg">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_warnmsg</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="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>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.log_err">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_err</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#log_err"><span class="viewcode-link">[source]</span></a><a class="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>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.error">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">error</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.logger.error" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Logs an error message to the server log.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.err">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">err</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.logger.err" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Logs an error message to the server log.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.log_errmsg">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_errmsg</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="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>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.log_trace">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_trace</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#log_trace"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.log_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>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.log_tracemsg">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_tracemsg</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.logger.log_tracemsg" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Log a traceback to the log. This should be called from within an
|
||
exception.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.exception">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">exception</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="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
|
||
exception.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.critical">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">critical</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="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
|
||
exception.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.trace">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">trace</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="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>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.log_dep">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_dep</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#log_dep"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.log_dep" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Prints a deprecation message.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.dep">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">dep</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.logger.dep" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Prints a deprecation message.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.deprecated">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">deprecated</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.logger.deprecated" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Prints a deprecation message.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.log_depmsg">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_depmsg</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.logger.log_depmsg" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Prints a deprecation message.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.log_sec">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_sec</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#log_sec"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.log_sec" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Prints a security-related message.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<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>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.sec">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">sec</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.logger.sec" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Prints a security-related message.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<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>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.security">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">security</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.logger.security" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Prints a security-related message.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<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>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.log_secmsg">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_secmsg</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.logger.log_secmsg" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Prints a security-related message.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<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>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.log_server">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_server</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#log_server"><span class="viewcode-link">[source]</span></a><a class="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>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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>
|
||
|
||
<dl class="py class">
|
||
<dt id="evennia.utils.logger.GetLogObserver">
|
||
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">GetLogObserver</code><a class="reference internal" href="../_modules/evennia/utils/logger.html#GetLogObserver"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.GetLogObserver" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
|
||
<p>Sets up how the system logs are formatted.</p>
|
||
<dl class="py attribute">
|
||
<dt id="evennia.utils.logger.GetLogObserver.component_prefix">
|
||
<code class="sig-name descname">component_prefix</code><em class="property"> = ''</em><a class="headerlink" href="#evennia.utils.logger.GetLogObserver.component_prefix" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.utils.logger.GetLogObserver.event_levels">
|
||
<code class="sig-name descname">event_levels</code><em class="property"> = {<LogLevel=debug>: '??', <LogLevel=info>: '..', <LogLevel=warn>: 'WW', <LogLevel=error>: 'EE', <LogLevel=critical>: '!!'}</em><a class="headerlink" href="#evennia.utils.logger.GetLogObserver.event_levels" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.logger.GetLogObserver.format_log_event">
|
||
<code class="sig-name descname">format_log_event</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">event</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#GetLogObserver.format_log_event"><span class="viewcode-link">[source]</span></a><a class="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
|
||
in the default log output.</p>
|
||
<p>[component_prefix] [date] [system/lvl] [msg]</p>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="evennia.utils.logger.GetPortalLogObserver">
|
||
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">GetPortalLogObserver</code><a class="reference internal" href="../_modules/evennia/utils/logger.html#GetPortalLogObserver"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.GetPortalLogObserver" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.logger.GetLogObserver" title="evennia.utils.logger.GetLogObserver"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.logger.GetLogObserver</span></code></a></p>
|
||
<dl class="py attribute">
|
||
<dt id="evennia.utils.logger.GetPortalLogObserver.component_prefix">
|
||
<code class="sig-name descname">component_prefix</code><em class="property"> = '|Portal| '</em><a class="headerlink" href="#evennia.utils.logger.GetPortalLogObserver.component_prefix" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="evennia.utils.logger.GetServerLogObserver">
|
||
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">GetServerLogObserver</code><a class="reference internal" href="../_modules/evennia/utils/logger.html#GetServerLogObserver"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.GetServerLogObserver" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.logger.GetLogObserver" title="evennia.utils.logger.GetLogObserver"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.logger.GetLogObserver</span></code></a></p>
|
||
<dl class="py attribute">
|
||
<dt id="evennia.utils.logger.GetServerLogObserver.component_prefix">
|
||
<code class="sig-name descname">component_prefix</code><em class="property"> = ''</em><a class="headerlink" href="#evennia.utils.logger.GetServerLogObserver.component_prefix" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.timeformat">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">timeformat</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">when</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#timeformat"><span class="viewcode-link">[source]</span></a><a class="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>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="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>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p><em>timestring (str)</em> – A formatted string of the given time.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="evennia.utils.logger.WeeklyLogFile">
|
||
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">WeeklyLogFile</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">directory</span></em>, <em class="sig-param"><span class="n">defaultMode</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">day_rotation</span><span class="o">=</span><span class="default_value">7</span></em>, <em class="sig-param"><span class="n">max_size</span><span class="o">=</span><span class="default_value">1000000</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#WeeklyLogFile"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.WeeklyLogFile" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">twisted.python.logfile.DailyLogFile</span></code></p>
|
||
<p>Log file that rotates once per week by default. Overrides key methods to change format.</p>
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.logger.WeeklyLogFile.__init__">
|
||
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">directory</span></em>, <em class="sig-param"><span class="n">defaultMode</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">day_rotation</span><span class="o">=</span><span class="default_value">7</span></em>, <em class="sig-param"><span class="n">max_size</span><span class="o">=</span><span class="default_value">1000000</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#WeeklyLogFile.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.WeeklyLogFile.__init__" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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
|
||
time). Defaults to 1M.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.logger.WeeklyLogFile.shouldRotate">
|
||
<code class="sig-name descname">shouldRotate</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#WeeklyLogFile.shouldRotate"><span class="viewcode-link">[source]</span></a><a class="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>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.logger.WeeklyLogFile.suffix">
|
||
<code class="sig-name descname">suffix</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">tupledate</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#WeeklyLogFile.suffix"><span class="viewcode-link">[source]</span></a><a class="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>
|
||
<p class="rubric">Examples</p>
|
||
<p>server.log.2020_01_29
|
||
server.log.2020_01_29__1
|
||
server.log.2020_01_29__2</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.logger.WeeklyLogFile.rotate">
|
||
<code class="sig-name descname">rotate</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#WeeklyLogFile.rotate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.WeeklyLogFile.rotate" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Rotate the file and create a new one.</p>
|
||
<p>If it’s not possible to open new logfile, this will fail silently,
|
||
and continue logging to old logfile.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.logger.WeeklyLogFile.write">
|
||
<code class="sig-name descname">write</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">data</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#WeeklyLogFile.write"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.WeeklyLogFile.write" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Write data to log file</p>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="evennia.utils.logger.EvenniaLogFile">
|
||
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">EvenniaLogFile</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">directory</span></em>, <em class="sig-param"><span class="n">rotateLength</span><span class="o">=</span><span class="default_value">1000000</span></em>, <em class="sig-param"><span class="n">defaultMode</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">maxRotatedFiles</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#EvenniaLogFile"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.EvenniaLogFile" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">twisted.python.logfile.LogFile</span></code></p>
|
||
<p>A rotating logfile based off Twisted’s LogFile. It overrides
|
||
the LogFile’s rotate method in order to append some of the last
|
||
lines of the previous log to the start of the new log, in order
|
||
to preserve a continuous chat history for channel log files.</p>
|
||
<dl class="py attribute">
|
||
<dt id="evennia.utils.logger.EvenniaLogFile.settings">
|
||
<code class="sig-name descname">settings</code><em class="property"> = <LazySettings "evennia.settings_default"></em><a class="headerlink" href="#evennia.utils.logger.EvenniaLogFile.settings" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.utils.logger.EvenniaLogFile.num_lines_to_append">
|
||
<code class="sig-name descname">num_lines_to_append</code><em class="property"> = 20</em><a class="headerlink" href="#evennia.utils.logger.EvenniaLogFile.num_lines_to_append" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.logger.EvenniaLogFile.rotate">
|
||
<code class="sig-name descname">rotate</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">num_lines_to_append</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#EvenniaLogFile.rotate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.EvenniaLogFile.rotate" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Rotates our log file and appends some number of lines from
|
||
the previous log to the start of the new one.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.logger.EvenniaLogFile.seek">
|
||
<code class="sig-name descname">seek</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#EvenniaLogFile.seek"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.EvenniaLogFile.seek" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Convenience method for accessing our _file attribute’s seek method,
|
||
which is used in tail_log_function.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>*args</strong> – Same args as file.seek</p></li>
|
||
<li><p><strong>**kwargs</strong> – Same kwargs as file.seek</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.utils.logger.EvenniaLogFile.readlines">
|
||
<code class="sig-name descname">readlines</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#EvenniaLogFile.readlines"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.EvenniaLogFile.readlines" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Convenience method for accessing our _file attribute’s readlines method,
|
||
which is used in tail_log_function.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>*args</strong> – same args as file.readlines</p></li>
|
||
<li><p><strong>**kwargs</strong> – same kwargs as file.readlines</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p><em>lines (list)</em> – lines from our _file attribute.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.log_file">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_file</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">msg</span></em>, <em class="sig-param"><span class="n">filename</span><span class="o">=</span><span class="default_value">'game.log'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#log_file"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.log_file" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Arbitrary file logger using threads.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>msg</strong> (<em>str</em>) – String to append to logfile.</p></li>
|
||
<li><p><strong>filename</strong> (<em>str</em><em>, </em><em>optional</em>) – Defaults to ‘game.log’. All logs
|
||
will appear in the logs directory and log entries will start
|
||
on new lines following datetime info.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.log_file_exists">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_file_exists</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">filename</span><span class="o">=</span><span class="default_value">'game.log'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#log_file_exists"><span class="viewcode-link">[source]</span></a><a class="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>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>filename</strong> (<em>str</em>) – The filename (within the log-dir).</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p><em>bool</em> – If the log file exists or not.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.rotate_log_file">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">rotate_log_file</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">filename</span><span class="o">=</span><span class="default_value">'game.log'</span></em>, <em class="sig-param"><span class="n">num_lines_to_append</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#rotate_log_file"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.rotate_log_file" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Force-rotate a log-file, without</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="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.
|
||
Set to 0 to include no lines.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.delete_log_file">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">delete_log_file</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">filename</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#delete_log_file"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.delete_log_file" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Delete a log file</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>filename</strong> (<em>str</em>) – The name of the log file, located in settings.LOG_DIR</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.utils.logger.tail_log_file">
|
||
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">tail_log_file</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">filename</span></em>, <em class="sig-param"><span class="n">offset</span></em>, <em class="sig-param"><span class="n">nlines</span></em>, <em class="sig-param"><span class="n">callback</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#tail_log_file"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.tail_log_file" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Return the tail of the log file.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<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>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p><p><em>lines (deferred or list)</em> –</p>
|
||
<dl class="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
|
||
all if the file is shorter than nlines.</p>
|
||
</dd>
|
||
</dl>
|
||
</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</section>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="related" role="navigation" aria-label="related navigation">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
>index</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="right" >
|
||
<a href="evennia.utils.optionclasses.html" title="evennia.utils.optionclasses"
|
||
>next</a> |</li>
|
||
<li class="right" >
|
||
<a href="evennia.utils.gametime.html" title="evennia.utils.gametime"
|
||
>previous</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../index.html">Evennia 3.x</a> »</li>
|
||
<li class="nav-item nav-item-1"><a href="../Evennia-API.html" >API Summary</a> »</li>
|
||
<li class="nav-item nav-item-2"><a href="evennia-api.html" >evennia</a> »</li>
|
||
<li class="nav-item nav-item-3"><a href="evennia.html" >evennia</a> »</li>
|
||
<li class="nav-item nav-item-4"><a href="evennia.utils.html" >evennia.utils</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">evennia.utils.logger</a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
|
||
<div class="admonition important">
|
||
<p class="first admonition-title">Note</p>
|
||
<p class="last">You are reading an old version of the Evennia documentation. <a href="https://www.evennia.com/docs/latest/index.html">The latest version is here</a></p>.
|
||
</div>
|
||
|
||
|
||
<div class="footer" role="contentinfo">
|
||
© Copyright 2023, The Evennia developer community.
|
||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
|
||
</div>
|
||
</body>
|
||
</html> |