@@ -59,7 +59,10 @@ class TouchscreenPoller(object):
5959 """Get 'pressed' and location updates from a touch screen device."""
6060
6161 def __init__ (self , splash , cursor_bmp ):
62- logging .getLogger ("Paint" ).debug ("Creating a TouchscreenPoller" )
62+ logger = logging .getLogger ("Paint" )
63+ if not logger .hasHandlers ():
64+ logger .addHandler (logging .StreamHandler ())
65+ logger .debug ("Creating a TouchscreenPoller" )
6366 self ._display_grp = splash
6467 self ._touchscreen = adafruit_touchscreen .Touchscreen (
6568 board .TOUCH_XL , board .TOUCH_XR ,
@@ -118,14 +121,16 @@ class CursorPoller(object):
118121 """Get 'pressed' and location updates from a D-Pad/joystick device."""
119122
120123 def __init__ (self , splash , cursor_bmp ):
121- logging .getLogger ("Paint" ).debug ("Creating a CursorPoller" )
124+ self ._logger = logging .getLogger ("Paint" )
125+ if not self ._logger .hasHandlers ():
126+ self ._logger .addHandler (logging .StreamHandler ())
127+ self ._logger .debug ("Creating a CursorPoller" )
122128 self ._mouse_cursor = Cursor (
123129 board .DISPLAY , display_group = splash , bmp = cursor_bmp , cursor_speed = 2
124130 )
125131 self ._x_offset = cursor_bmp .width // 2
126132 self ._y_offset = cursor_bmp .height // 2
127133 self ._cursor = DebouncedCursorManager (self ._mouse_cursor )
128- self ._logger = logging .getLogger ("Paint" )
129134
130135 def poll (self ):
131136 """Check for input. Returns press of A (a bool), B,
@@ -160,6 +165,8 @@ def set_cursor_bitmap(self, bmp):
160165class Paint (object ):
161166 def __init__ (self , display = board .DISPLAY ):
162167 self ._logger = logging .getLogger ("Paint" )
168+ if not self ._logger .hasHandlers ():
169+ self ._logger .addHandler (logging .StreamHandler ())
163170 self ._logger .setLevel (logging .DEBUG )
164171 self ._display = display
165172 self ._w = self ._display .width
0 commit comments