On Wed, Mar 14, 2012 at 12:29 AM, Peter Bittner <[email protected]> wrote:
> Taa-taa!
>
> Pyjamas now has a flexible logging module. I just pushed the code.
>
> The pyjamas.logging module builds upon CPython's logging module. This
> means that the new module supports the whole features set of the
> Python logging module, as described in the Python module documentation
> [1]. The Pyjamas logging module provides 3 new handlers (as of today)
> to print out log messages:

 ooo that's almost scarey :)

> I have replaced the print statements in doc/pyjs_site/website.py by
> logger calls, check out this example!
>
> TODO:
>  * ConsoleHandler is not fully functional: The JS(...) function
> requires the argument being a string constant. Unfortunately the log
> messages aren't constant strings at compile time. This is the error
> message:
>
>    [...]
>    translator_proto.TranslationError: pyjamas.logging.handlers line 49:
>    JS function only supports constant strings
>    CallFunc(Name('JS'), [Mod(Const(" console.log('%s') "),
> Name('msg'))], None, None)
>
> Any ideas how to fix this?

 err err   what the heck are you doing? :)

 i can't even find the damn code!  ok, i'll find it with git diff...

 oi!  keep whitespace commits separate from functional commits!  this
should be 3 lines but it's not.... oops.  baad peterrrr :)

 more once i've worked out what's going on.

 l.

diff --git a/doc/pyjs_site/website.py b/doc/pyjs_site/website.py
index 65e03d1..b727eb8 100644
--- a/doc/pyjs_site/website.py
+++ b/doc/pyjs_site/website.py
@@ -1,27 +1,29 @@
 import pyjd # dummy in pyjs

-from pyjamas.ui.TabBar import TabBar
-from pyjamas.ui.TabPanel import TabPanel
-from pyjamas.ui import HasAlignment
-from pyjamas.ui.Image import Image
-from pyjamas.ui.DockPanel import DockPanel
+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
 from pyjamas.ui import HasAlignment
-from pyjamas.ui.VerticalPanel import VerticalPanel
-from pyjamas.ui.RootPanel import RootPanel
-from pyjamas.ui.HorizontalPanel import HorizontalPanel
-from pyjamas.ui.HTML import HTML
-from pyjamas.ui.Composite import Composite
-#from pyjamas.ui import DecoratorPanel
 from pyjamas.ui import MouseListener
-from pyjamas.ui import Event
-from pyjamas import Window
-from pyjamas import DeferredCommand
+from pyjamas.ui.Composite import Composite
 from pyjamas.ui.DecoratorPanel import DecoratedTabPanel, DecoratorPanel
 from pyjamas.ui.DecoratorPanel import DecoratorTitledPanel
-from pyjamas.HTTPRequest import HTTPRequest
-from PageLoader import PageListLoader, PageLoader
+from pyjamas.ui.DockPanel import DockPanel
+from pyjamas.ui.HorizontalPanel import HorizontalPanel
+from pyjamas.ui.HTML import HTML
 from pyjamas.ui.HTMLLinkPanel import HTMLLinkPanel
-from pyjamas import History
+from pyjamas.ui.Image import Image
+from pyjamas.ui.RootPanel import RootPanel
+from pyjamas.ui.TabBar import TabBar
+from pyjamas.ui.TabPanel import TabPanel
+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)

Reply via email to