-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFAQ.html
More file actions
71 lines (67 loc) · 5.04 KB
/
Copy pathFAQ.html
File metadata and controls
71 lines (67 loc) · 5.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Pyjs</title>
<link rel="stylesheet" type="text/css" media="screen" href="assets/main.css"/>
</head>
<body>
<div id="menu">
<div id="logo"><a href="./" title="Pyjs!"><img src="assets/images/pyjs.128x128.png" alt="Pyjs Logo" /></a></div>
<ul class="simple">
<li class="section">About</li>
<li><a class="reference external" href="About.html">About</a></li>
<li><a class="reference external" href="Overview.html">Overview</a></li>
<li><a class="reference external" href="Translator.html">Translator</a></li>
<li><a class="reference external" href="Download.html">Download</a></li>
<li><a class="reference external" href="GettingHelp.html">Getting Help</a></li>
<li class="section">Documentation</li>
<li><a class="reference external" href="examples">Examples</a></li>
<li><a class="reference external" href="UIHierarchy.html">UI Hierarchy</a></li>
<li><a class="reference external" href="api">API Docs</a></li>
<li><a class="reference external" href="book/Bookreader.html">Book</a></li>
<li><a class="reference external" href="https://github.com/pyjs/pyjs/wiki">Wiki</a></li>
<li class="section">Development</li>
<li><a class="reference external" href="Developing.html">Develop</a></li>
<li><a class="reference external" href="Optimize.html">Optimize</a></li>
<li><a class="reference external" href="Contribute.html">Contribute</a></li>
<li><a class="reference external" href="Roadmap.html">Roadmap</a></li>
<li class="section">Deprecated</li>
<li><a class="reference external" href="FAQ.html">FAQ</a></li>
</ul>
</div>
<div id="body">
<h1 class="title">pyjs FAQ</h1>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#i-have-made-changes-to-a-pyjs-source-file-how-do-i-submit-my-contribution" id="id1">I have made changes to a pyjs source file. How do I submit my contribution?</a></li>
<li><a class="reference internal" href="#i-want-to-throw-some-debug-output-onto-the-screen-how-do-i-best-do-that" id="id2">I want to throw some debug output onto the screen. How do I best do that?</a></li>
</ul>
</div>
<div class="section" id="i-have-made-changes-to-a-pyjs-source-file-how-do-i-submit-my-contribution">
<h1><a class="toc-backref" href="#contents">I have made changes to a pyjs source file. How do I submit my contribution?</a></h1>
<p>Contributions are very welcome! For all source changes use the workflows provided by GitHub: Fork the project, apply your changes, make a pull request. See the website's <a class="reference external" href="Contribute.html">Contribute</a> page for more details.</p>
</div>
<div class="section" id="i-want-to-throw-some-debug-output-onto-the-screen-how-do-i-best-do-that">
<h1><a class="toc-backref" href="#contents">I want to throw some debug output onto the screen. How do I best do that?</a></h1>
<p>With pyjs you can use full Python-style logging (Python's flexible <a class="reference external" href="http://docs.python.org/library/logging.html">event logging module</a> has been ported to pyjs). Additional handlers allow you to display log messages in a dedicated <em>div</em> element in the HTML document, in the Web browser's error console, and with JavaScript's alert() function.</p>
<pre class="literal-block">
from pyjamas import logging
log = logging.getConsoleLogger() # other loggers: Alert, Append, Print ...
...
log.error("Hello, here is an %s error", err_name)
</pre>
<p>For a good understanding of the logging module read the <a class="reference external" href="http://docs.python.org/howto/logging.html">Python Logging HOWTO</a>; most of it directly applies to pyjs. Additional Loggers provided by pyjs, and how you'd use them:</p>
<ol class="arabic simple">
<li>AlertLogger: <tt class="docutils literal">log = logging.getAlertLogger()</tt> shows a browser alert popup dialog for each log message.</li>
<li>AppendLogger: <tt class="docutils literal">log = logging.getAppendLogger()</tt> appends text to the end of the HTML document body. The <em>div</em> element holding the log messages can be accessed by its element ID ('logging_*loggername*', 'logging_pyjs' by default) for styling.</li>
<li>ConsoleLogger: <tt class="docutils literal">log = logging.getConsoleLogger()</tt> passes log messages on to the error console of Firebug/Chrome/Opera/<a class="reference external" href="http://msdn.microsoft.com/en-us/library/dd565625(v=vs.85).aspx">IE8+</a> using the <a class="reference external" href="http://getfirebug.com/logging">console logging</a> functions.</li>
<li>PrintLogger: <tt class="docutils literal">log = logging.getPrintLogger()</tt> prints text to <em>cerr</em>, the default error output stream. This is a good choice when developing/testing with pyjs Desktop.</li>
<li>NullLogger: <tt class="docutils literal">log = logging.getNullLogger()</tt> disable logging completely and safely.</li>
</ol>
</div>
</div>
</body>
</html>