Permalink
Browse files

logging: migrated all references from pyjamas.log -> pyjamas.logging

  • Loading branch information...
1 parent 4594990 commit 2f217fd05f87a1bbecd4025646c427c44af490bf @bittner bittner committed Apr 9, 2012
Showing with 167 additions and 138 deletions.
  1. +3 −1 addons/DeferredHandler.py
  2. +7 −5 addons/FlowPlayer.py
  3. +10 −9 addons/RichTextEditor.py
  4. +1 −7 ...e/public/faq/answers/i_want_to_throw_some_debug_output_onto_the_screen_how_do_i_best_do_that.html
  5. +9 −8 doc/pyjs_site/website.py
  6. +3 −1 examples/asteroids/Space.py
  7. +4 −3 examples/clickoverride/Override.py
  8. BIN examples/flowpanel/public/images/pyjamas.png
  9. +7 −6 examples/gwtcanvas/LogoDemo.py
  10. BIN examples/helloworldsplash/public/pyjamas.png
  11. +5 −4 examples/jsimport/examplejs.py
  12. +4 −2 examples/kitchensink/KitchenSink.py
  13. +2 −1 examples/libtest/BuiltinTest.py
  14. +4 −3 examples/maparea/MapAreaDemo.py
  15. +13 −13 examples/misc/djangowanted/media/WebPage.py
  16. +5 −5 examples/misc/djangoweb/media/WebPage.py
  17. +14 −12 examples/misc/flowplayer/fp.py
  18. +5 −4 examples/misc/simplewiki/Wiki.py
  19. +12 −10 examples/misc/swfupload/swfu.py
  20. +3 −2 examples/raphael/events.py
  21. +4 −2 examples/raphael/graffle.py
  22. +3 −2 examples/raphael/raphael_showcase.py
  23. +2 −1 examples/raphael/spinner.py
  24. +6 −4 examples/shell/Screen.py
  25. +5 −3 examples/shell/textconsole.py
  26. +3 −5 library/pyjamas/Canvas/GWTCanvasImplDefault.py
  27. +2 −1 library/pyjamas/Factory.py
  28. +5 −6 library/pyjamas/chart/GChartWidgets.py
  29. +2 −1 library/pyjamas/feed/Feed.py
  30. +2 −1 library/pyjamas/raphael/raphael.py
  31. +2 −1 library/pyjamas/ui/BuilderPanel.py
  32. +1 −1 library/pyjamas/ui/FlashPanel.browser.py
  33. +4 −2 library/pyjamas/ui/FlashPanel.py
  34. +3 −1 library/pyjamas/ui/Widget.py
  35. +12 −11 pygtkweb/library/gtk.py
@@ -5,7 +5,9 @@
"""
from pyjamas.Timer import Timer
-from pyjamas import log
+from pyjamas import logging
+
+log = logging.getAppendLogger(__name__, logging.DEBUG, logging.PLAIN_FORMAT)
global deferredHandlers
deferredHandlers = []
View
@@ -14,7 +14,9 @@
from pyjamas.Timer import Timer
import urllib
from __pyjamas__ import wnd
-from pyjamas import log
+from pyjamas import logging
+
+log = logging.getAppendLogger(__name__, logging.DEBUG, logging.PLAIN_FORMAT)
"""
Global variables called by Flash External Interface
@@ -196,7 +198,7 @@ def __createFlashVars(self, config):
#config_string = config_string.replace('<', '&lt;')
#config_string = config_string.replace('>', '&gt;')
config_string = config_string.replace('\'', '\\\'')
- #log.writebr(config_string)
+ #log.debug(config_string)
return config_string
def fireEvent(self, movieName, eventName, arguments):
@@ -205,9 +207,9 @@ def fireEvent(self, movieName, eventName, arguments):
Fire event
"""
- #log.writebr('FireEvent: %s/%s/%s' % (movieName, eventName, str(arguments)))
+ #log.debug('FireEvent: %s/%s/%s' % (movieName, eventName, str(arguments)))
if eventName == 'testFireEvent':
- log.writebr('fireEvent works')
+ log.debug('fireEvent works')
return
if eventName == 'onLoad' and arguments[0] == 'player':
self.loadApi()
@@ -251,7 +253,7 @@ def fireEvent(self, movieName, eventName, arguments):
DeferredHandler.add(eventMethod, [])
clip.fireEvent(eventName, arguments[2:])
else:
- #log.writebr('[FP Event] %s / %s' % (eventName, arguments))
+ #log.debug('[FP Event] %s / %s' % (eventName, arguments))
if hasattr(listener, eventName):
eventMethod = getattr(listener, eventName)
DeferredHandler.add(eventMethod, arguments)
View
@@ -5,14 +5,15 @@
FCKeditor javascript.
"""
-from pyjamas import Window
-from pyjamas import DOM
-from pyjamas import log
from BoundMethod import BoundMethod
+from pyjamas import logging
+from pyjamas import DOM
+from pyjamas import Window
from pyjamas.ui.Widget import Widget
-
from __pyjamas__ import JS
+log = logging.getAppendLogger(__name__, logging.DEBUG, logging.PLAIN_FORMAT)
+
def createFCK(name):
JS("""
@@ -106,22 +107,22 @@ def onFCKLoaded(self, fck):
self.pendingHTML = None
def onSelectionChange(self, sender):
- pass#log.writebr("onSelectionChange!")
+ pass#log.debug("onSelectionChange!")
def onBlur(self, sender):
- pass#log.writebr("onBlur!")
+ pass#log.debug("onBlur!")
def onFocus(self, sender):
- pass#log.writebr("onFocus!")
+ pass#log.debug("onFocus!")
def onPaste(self, sender):
- pass#log.writebr("onPaste!")
+ pass#log.debug("onPaste!")
def onSave(self):
"""
Handle the save click and pass it onto the listeners.
"""
- log.writebr("onSave() in %s", Window.getLocation().getHref())
+ log.debug("onSave() in %s", Window.getLocation().getHref())
for listener in self.saveListeners:
if hasattr(listener, "onSave"):
listener.onSave(self)
@@ -10,13 +10,7 @@
from pyjamas import logging
log = logging.getConsoleLogger() # other loggers: Alert, Append, Print ...
...
-log.error("Hello, here is an error")
-</pre>
-<p>To make your life even easier there's also a convenience module that
-provides an AppendLogger with simple text output already by default:</p>
-<pre class="code">
-from pyjamas import log
-log.info('Show this text and value %s now', value)
+log.error("Hello, here is an %s error", err_name)
</pre>
<p>For a good understanding of the logging module read the
<a href="http://docs.python.org/howto/logging.html">Python
View
@@ -1,8 +1,8 @@
import pyjd # dummy in pyjs
+from pyjamas import logging
from pyjamas import DeferredCommand
from pyjamas import History
-from pyjamas import logging
from pyjamas import Window
from pyjamas.HTTPRequest import HTTPRequest
from pyjamas.ui import Event
@@ -22,8 +22,8 @@
from pyjamas.ui.VerticalPanel import VerticalPanel
from PageLoader import PageListLoader, PageLoader
-# global logger. Set level to DEBUG to see the log.debug() messages too!
-log = logging.getPrintLogger('pyjs_site', logging.INFO)
+# global logger. Set level higher than DEBUG to see less logging messages
+log = logging.getConsoleLogger()
#class PrettyTab(DecoratorPanel):
class PrettyTab(Composite):
@@ -87,6 +87,7 @@ def execute(self):
def onWindowResized(self, width, height):
tabwidth = "%dpx" % (width - 350)
+ log.info('New tab control width = %s <a href="foo.bar">foo.bar</a>', tabwidth)
#width = "%dpx" % (width-20)
#self.header.setWidth(width)
#self.dock.setCellWidth(self.header, width)
@@ -96,13 +97,12 @@ def onWindowResized(self, width, height):
self.dock.setCellWidth(self.fTabs, tabwidth)
def createPage(self, title, purpose, text):
-
- log.debug("create page %s %s %s", title, purpose, text)
+ #log.debug("create page %s %s %s", title, purpose, text)
if purpose == 'faq':
self.faq_pages[title] = text
log.debug("%d %d", len(self.faq_pages), len(self.faq_list))
- log.debug(self.faq_pages.keys())
- log.debug(self.faq_list)
+ #log.debug(self.faq_pages.keys())
+ #log.debug(self.faq_list)
if len(self.faq_pages) != len(self.faq_list):
return
faq = self.page_widgets['FAQ']
@@ -151,7 +151,7 @@ def createPage(self, title, purpose, text):
History.addHistoryListener(self)
initToken = History.getToken()
- log.info("initial token: '%s'", initToken)
+ log.debug("initial token: '%s'", initToken)
self.onHistoryChanged(initToken)
self.fTabs.addTabListener(self)
@@ -171,6 +171,7 @@ def onHistoryChanged(self, token):
def onError(self, text, code):
log.error("LOAD ERROR(%s): %s", str(code), text)
+ pass
def loadPageList(self):
HTTPRequest().asyncGet("sidebar.html",
@@ -28,7 +28,7 @@
#from pyjamas.Canvas2D import Canvas, CanvasImage, ImageLoadListener
from pyjamas.Timer import Timer
from pyjamas import Window
-from pyjamas import log
+#from pyjamas import logging
from pyjamas.ui import Event
from pyjamas.ui import KeyboardListener
from pyjamas.ui.KeyboardListener import KeyboardHandler
@@ -40,6 +40,8 @@
import pygwt
import random
+#log = logging.getAppendLogger(__name__, logging.DEBUG, logging.PLAIN_FORMAT)
+
NUM_ASTEROIDS = 2
FPS = 30
ROTATE_SPEED_PER_SEC = math.pi
@@ -12,8 +12,9 @@
from pyjamas.ui.ClickListener import ClickHandler
from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui import Event
-from pyjamas import log
from pyjamas import DOM
+from pyjamas import logging
+log = logging.getAppendLogger(__name__, logging.DEBUG, logging.PLAIN_FORMAT)
class Board(VerticalPanel, ClickHandler):
def __init__(self):
@@ -34,7 +35,7 @@ def __init__(self):
self.setBorderWidth(1)
def onClick(self, sender):
- log.writebr('Text'+str(sender))
+ log.debug('Text'+str(sender))
def _event_targets_title(self, event):
target = DOM.eventGetTarget(event)
@@ -55,7 +56,7 @@ def __init__(self, text):
self.addClickListener(self)
def onClick(self, sender):
- log.writebr('Text'+str(sender))
+ log.debug('Text'+str(sender))
if __name__ == "__main__":
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -26,7 +26,8 @@
from SimpleCanvasDemo import SimpleCanvasDemo
-#from pyjamas import log
+#from pyjamas import logging
+#log = logging.getAppendLogger(__name__, logging.DEBUG, logging.PLAIN_FORMAT)
class LogoDemoControls(Composite):
def __init__(self):
@@ -83,14 +84,14 @@ def drawDemo(self):
# Go ahead and animate
if self.isImageLoaded(self.img):
self.run = True
- #log.writebr("already loaded")
+ #log.debug("already loaded")
Timer(1, self)
else:
Window.alert("Refresh the page to reload the image.")
def onImagesLoaded(self, imageHandles):
- #log.writebr("loaded")
+ #log.debug("loaded")
# Drawing code involving images goes here
self.img = imageHandles[0]
self.run = True
@@ -113,8 +114,8 @@ def renderingLoop(self):
# Draw starting at position 10, 10
# scaled up by a factor of 2 on the self.canvas (using 200x200 as the
# destination dimensions).
- #log.writebr(str(self.img))
- #log.writebr(DOM.getAttribute("src"))
+ #log.debug(str(self.img))
+ #log.debug(DOM.getAttribute("src"))
#self.canvas.drawImage(self.img, 84, 74, 100, 100, 10, 10, 200, 200)
self.canvas.drawImage(self.img, 84, 74)
@@ -128,7 +129,7 @@ def renderingLoop(self):
self.canvas.restoreContext()
- #log.writebr(str(self.rotation))
+ #log.debug(str(self.rotation))
def onTimer(self, timer):
if not self.run:
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -8,7 +8,8 @@
# if you ABSOLUTELY MUST use javascript, here's how to do it.
#
-from pyjamas import log
+from pyjamas import logging
+log = logging.getAppendLogger(__name__, logging.DEBUG, logging.PLAIN_FORMAT)
# this simply tells the compiler that the two names are to be dropped
# into the javascript global namespace
@@ -24,11 +25,11 @@ def main():
global examplevar
#examplevar is actually "out of modules", in a super scope
- log.writebr(examplevar)
+ log.debug(examplevar)
examplevar = 'Altered'
- log.writebr(get_examplevar())
+ log.debug(get_examplevar())
main()
examplevar = "Realtered"
-log.writebr(get_examplevar())
+log.debug(get_examplevar())
@@ -1,15 +1,16 @@
import pyjd # this is dummy in pyjs
+from pyjamas import logging
from pyjamas.ui.Button import Button
from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.HTML import HTML
from pyjamas.ui.DockPanel import DockPanel
from pyjamas.ui import HasAlignment
from pyjamas.ui.Hyperlink import Hyperlink
from pyjamas.ui.VerticalPanel import VerticalPanel
-from pyjamas import Window
from pyjamas.ui.Sink import SinkList
from pyjamas import History
+from pyjamas import Window
import Info
import Buttons
import Layouts
@@ -23,7 +24,8 @@
import Frames
import Tabs
from Logger import Logger
-from pyjamas import log
+
+log = logging.getAppendLogger(__name__, logging.DEBUG, logging.PLAIN_FORMAT)
class KitchenSink:
@@ -27,7 +27,8 @@ def fget(self):
return (self.r, self.g, self.b)
return property(**locals())
-#from pyjamas import log
+#from pyjamas import logging
+#log = logging.getAppendLogger(__name__, logging.DEBUG, logging.PLAIN_FORMAT)
class C(object):
@property
@@ -1,6 +1,7 @@
import pyjd
from pyjamas import DOM
+from pyjamas import logging
from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.HTML import HTML
@@ -13,7 +14,7 @@
from pyjamas.ui.Image import Image
from pyjamas.ui.ContextMenuPopupPanel import ContextMenuPopupPanel
-from pyjamas import log
+log = logging.getAppendLogger(__name__, logging.DEBUG, logging.PLAIN_FORMAT)
class MapAreaDemo:
@@ -105,7 +106,7 @@ def _mouseActionMessage(self, name, action, x=None, y=None):
#msg = "%s %s (%d,%d)" % (name, action, x, y) # throws JS errors
msg = name + ' ' + action + ' (' + str(x) + ', ' + str(y) + ')'
self.msgarea1.setText(msg)
- log.writebr(msg)
+ log.debug(msg)
def onMouseMove(self, sender, x, y):
self._mouseActionMessage(sender.areaname, "move", x, y)
@@ -125,7 +126,7 @@ def onMouseLeave(self, sender):
def onClick(self, sender):
msg = "you clicked on baby katie's " + sender.areaname
self.msgarea2.setText(msg)
- log.writebr(msg)
+ log.debug(msg)
if __name__ == '__main__':
Oops, something went wrong.

0 comments on commit 2f217fd

Please sign in to comment.