-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82eba8d
commit f4d07b0
Showing
28 changed files
with
311 additions
and
65 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
**Debugging diceroll** | ||
======================= | ||
**diceroll 2.2** keeps a log file of any dice rolls made during its last run. You will find ``diceroll.log`` in the ``Logs`` | ||
folder it creates if one isn't there already. In the file you will see mentions of dice being rolled. **diceroll** uses | ||
a default logging mode of ``INFO`` which isn't that verbose. :: | ||
|
||
module_log.setLevel(logging.INFO) | ||
|
||
Sun, 01 Oct 2017 16:08:03 INFO diceroll - Logging started. | ||
Sun, 01 Oct 2017 16:08:03 INFO diceroll - roll() v2.2 started, and running... | ||
Sun, 01 Oct 2017 16:08:03 INFO diceroll - 3D4 = 3D4+0 = 10 | ||
|
||
Changing **diceroll's** logging mode to ``DEBUG`` will record debugging messages in the ``Logs\diceroll.log`` file. :: | ||
|
||
module_log.setLevel(logging.DEBUG) | ||
|
||
Sun, 01 Oct 2017 16:27:21 INFO diceroll - Logging started. | ||
Sun, 01 Oct 2017 16:27:21 INFO diceroll - roll() v2.2 started, and running... | ||
Sun, 01 Oct 2017 16:27:21 DEBUG diceroll - Asked to roll 3D4: | ||
Sun, 01 Oct 2017 16:27:21 DEBUG diceroll - Using three 4-sided dice... | ||
Sun, 01 Oct 2017 16:27:21 DEBUG diceroll - Rolled a 4 | ||
Sun, 01 Oct 2017 16:27:21 DEBUG diceroll - Rolled a 2 | ||
Sun, 01 Oct 2017 16:27:21 DEBUG diceroll - Rolled a 2 | ||
Sun, 01 Oct 2017 16:27:21 INFO diceroll - 3D4 = 3D4+0 = 8 | ||
|
||
.. note:: | ||
Running **diceroll** in ``DEBUG`` mode may create a log while that will be too huge to open. A program of yours | ||
left running for a long period of time could create millions of lines of recorded log entries. Fortunately, ``diceroll.log`` is | ||
reset each time your program is run. Also, any errors encountered will be recorded as ``ERROR`` in the log file, no | ||
matter which logging mode you've chosen to use. | ||
|
||
If your own code has logging enabled for it, be sure to let **diceroll** know by changing ``your_code_name_here`` to | ||
the name of the program you're calling ``roll()`` from. :: | ||
|
||
log = logging.getLogger('your_code_name_here.diceroll') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
**diceroll Module** | ||
=================== | ||
**The diceroll Module** | ||
======================= | ||
|
||
.. automodule:: diceroll | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<title>Debugging diceroll — diceroll 2.2 Manual</title> | ||
<link rel="stylesheet" href="_static/default.css" type="text/css" /> | ||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" /> | ||
<script type="text/javascript"> | ||
var DOCUMENTATION_OPTIONS = { | ||
URL_ROOT: '', | ||
VERSION: '2.2.1b', | ||
COLLAPSE_MODINDEX: false, | ||
FILE_SUFFIX: '.html' | ||
}; | ||
</script> | ||
<script type="text/javascript" src="_static/jquery.js"></script> | ||
<script type="text/javascript" src="_static/doctools.js"></script> | ||
<link rel="shortcut icon" href="_static/diceroll_icon_16x16.ico"/> | ||
<link rel="contents" title="Global table of contents" href="contents.html" /> | ||
<link rel="index" title="Global index" href="genindex.html" /> | ||
<link rel="search" title="Search" href="search.html" /> | ||
<link rel="top" title="diceroll 2.2 Manual" href="index.html" /> | ||
<link rel="prev" title="The diceroll Module" href="diceroll.html" /> | ||
</head> | ||
<body> | ||
<div class="related"> | ||
<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="modindex.html" title="Global Module Index" | ||
accesskey="M">modules</a> |</li> | ||
<li class="right" > | ||
<a href="diceroll.html" title="The diceroll Module" | ||
accesskey="P">previous</a> |</li> | ||
<li><a href="index.html">diceroll 2.2 Manual</a> »</li> | ||
</ul> | ||
</div> | ||
<div class="document"> | ||
<div class="documentwrapper"> | ||
<div class="bodywrapper"> | ||
<div class="body"> | ||
|
||
|
||
<div class="section" id="debugging-diceroll"> | ||
<h1><strong>Debugging diceroll</strong><a class="headerlink" href="#debugging-diceroll" title="Permalink to this headline">¶</a></h1> | ||
<p><strong>diceroll 2.2</strong> keeps a log file of any dice rolls made during its last run. You will find <tt class="docutils literal"><span class="pre">diceroll.log</span></tt> in the <tt class="docutils literal"><span class="pre">Logs</span></tt> | ||
folder it creates if one isn’t there already. In the file you will see mentions of dice being rolled. <strong>diceroll</strong> uses | ||
a default logging mode of <tt class="docutils literal"><span class="pre">INFO</span></tt> which isn’t that verbose.</p> | ||
<pre>module_log.setLevel(logging.INFO) | ||
|
||
Sun, 01 Oct 2017 16:08:03 INFO diceroll - Logging started. | ||
Sun, 01 Oct 2017 16:08:03 INFO diceroll - roll() v2.2 started, and running... | ||
Sun, 01 Oct 2017 16:08:03 INFO diceroll - 3D4 = 3D4+0 = 10</pre> | ||
<p>Changing <strong>diceroll’s</strong> logging mode to <tt class="docutils literal"><span class="pre">DEBUG</span></tt> will record debugging messages in the <tt class="docutils literal"><span class="pre">Logs\diceroll.log</span></tt> file.</p> | ||
<pre>module_log.setLevel(logging.DEBUG) | ||
|
||
Sun, 01 Oct 2017 16:27:21 INFO diceroll - Logging started. | ||
Sun, 01 Oct 2017 16:27:21 INFO diceroll - roll() v2.2 started, and running... | ||
Sun, 01 Oct 2017 16:27:21 DEBUG diceroll - Asked to roll 3D4: | ||
Sun, 01 Oct 2017 16:27:21 DEBUG diceroll - Using three 4-sided dice... | ||
Sun, 01 Oct 2017 16:27:21 DEBUG diceroll - Rolled a 4 | ||
Sun, 01 Oct 2017 16:27:21 DEBUG diceroll - Rolled a 2 | ||
Sun, 01 Oct 2017 16:27:21 DEBUG diceroll - Rolled a 2 | ||
Sun, 01 Oct 2017 16:27:21 INFO diceroll - 3D4 = 3D4+0 = 8</pre> | ||
<div class="admonition note"> | ||
<p class="first admonition-title">Note</p> | ||
<p class="last">Running <strong>diceroll</strong> in <tt class="docutils literal"><span class="pre">DEBUG</span></tt> mode may create a log while that will be too huge to open. A program of yours | ||
left running for a long period of time could create millions of lines of recorded log entries. Fortunately, <tt class="docutils literal"><span class="pre">diceroll.log</span></tt> is | ||
reset each time your program is run. Also, any errors encountered will be recorded as <tt class="docutils literal"><span class="pre">ERROR</span></tt> in the log file, no | ||
matter which logging mode you’ve chosen to use.</p> | ||
</div> | ||
<p>If your own code has logging enabled for it, be sure to let <strong>diceroll</strong> know by changing <tt class="docutils literal"><span class="pre">your_code_name_here</span></tt> to | ||
the name of the program you’re calling <tt class="docutils literal"><span class="pre">roll()</span></tt> from.</p> | ||
<div class="highlight"><pre><span class="n">log</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s">'your_code_name_here.diceroll'</span><span class="p">)</span> | ||
</pre></div> | ||
</div> | ||
|
||
|
||
</div> | ||
</div> | ||
</div> | ||
<div class="sphinxsidebar"> | ||
<div class="sphinxsidebarwrapper"> | ||
<h4>Previous topic</h4> | ||
<p class="topless"><a href="diceroll.html" title="previous chapter"><strong>The diceroll Module</strong></a></p> | ||
<h3>This Page</h3> | ||
<ul class="this-page-menu"> | ||
<li><a href="_sources/debugging.txt">Show Source</a></li> | ||
</ul> | ||
<h3>Quick search</h3> | ||
<form class="search" action="search.html" method="get"> | ||
<input type="text" name="q" size="18" /> <input type="submit" value="Go" /> | ||
<input type="hidden" name="check_keywords" value="yes" /> | ||
<input type="hidden" name="area" value="default" /> | ||
</form> | ||
</div> | ||
</div> | ||
<div class="clearer"></div> | ||
</div> | ||
<div class="related"> | ||
<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="modindex.html" title="Global Module Index" | ||
accesskey="M">modules</a> |</li> | ||
<li class="right" > | ||
<a href="diceroll.html" title="The diceroll Module" | ||
accesskey="P">previous</a> |</li> | ||
<li><a href="index.html">diceroll 2.2 Manual</a> »</li> | ||
</ul> | ||
</div> | ||
<div class="footer"> | ||
© Copyright 2017, Shawn Driscoll. | ||
Last updated on Oct 01, 2017. | ||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>. | ||
</div> | ||
</body> | ||
</html> |
Oops, something went wrong.