@@ -134,7 +134,6 @@ class CommandRunner:
134134 """
135135
136136 def __init__ (self , py3_wrapper ):
137- self .debug = py3_wrapper .config ["debug" ]
138137 self .py3_wrapper = py3_wrapper
139138
140139 def find_modules (self , requested_names ):
@@ -157,8 +156,7 @@ def find_modules(self, requested_names):
157156 if requested_name == name .split (" " )[0 ]:
158157 found_modules .add (module_name )
159158
160- if self .debug :
161- self .py3_wrapper .log (f"found { found_modules } " )
159+ self .py3_wrapper .log (f"found { found_modules } " , level = "debug" )
162160 return found_modules
163161
164162 def refresh (self , data ):
@@ -170,8 +168,7 @@ def refresh(self, data):
170168 update_i3status = False
171169 for module_name in self .find_modules (modules ):
172170 module = self .py3_wrapper .output_modules [module_name ]
173- if self .debug :
174- self .py3_wrapper .log (f"refresh { module } " )
171+ self .py3_wrapper .log (f"refresh { module } " , level = "debug" )
175172 if module ["type" ] == "py3status" :
176173 module ["module" ].force_update ()
177174 else :
@@ -197,8 +194,7 @@ def click(self, data):
197194 for name , message in CLICK_OPTIONS :
198195 event [name ] = data .get (name )
199196
200- if self .debug :
201- self .py3_wrapper .log (event )
197+ self .py3_wrapper .log (event , level = "debug" )
202198 # trigger the event
203199 self .py3_wrapper .events_thread .dispatch_event (event )
204200
@@ -207,8 +203,7 @@ def run_command(self, data):
207203 check the given command and send to the correct dispatcher
208204 """
209205 command = data .get ("command" )
210- if self .debug :
211- self .py3_wrapper .log (f"Running remote command { command } " )
206+ self .py3_wrapper .log (f"Running remote command { command } " , level = "debug" )
212207 if command == "refresh" :
213208 self .refresh (data )
214209 elif command == "refresh_all" :
@@ -226,7 +221,6 @@ class CommandServer(threading.Thread):
226221 def __init__ (self , py3_wrapper ):
227222 threading .Thread .__init__ (self )
228223
229- self .debug = py3_wrapper .config ["debug" ]
230224 self .py3_wrapper = py3_wrapper
231225
232226 self .command_runner = CommandRunner (py3_wrapper )
@@ -244,8 +238,7 @@ def __init__(self, py3_wrapper):
244238 sock = socket .socket (socket .AF_UNIX , socket .SOCK_STREAM )
245239 sock .bind (server_address .as_posix ())
246240
247- if self .debug :
248- self .py3_wrapper .log (f"Unix domain socket at { server_address } " )
241+ self .py3_wrapper .log (f"Unix domain socket at { server_address } " , level = "debug" )
249242
250243 # Listen for incoming connections
251244 sock .listen (1 )
@@ -270,19 +263,16 @@ def run(self):
270263 try :
271264 data = None
272265 # Wait for a connection
273- if self .debug :
274- self .py3_wrapper .log ("waiting for a connection" )
266+ self .py3_wrapper .log ("waiting for a connection" , level = "debug" )
275267
276268 connection , client_address = self .sock .accept ()
277269 try :
278- if self .debug :
279- self .py3_wrapper .log ("connection from" )
270+ self .py3_wrapper .log ("connection from" , level = "debug" )
280271
281272 data = connection .recv (MAX_SIZE )
282273 if data :
283274 data = json .loads (data .decode ("utf-8" ))
284- if self .debug :
285- self .py3_wrapper .log (f"received { data } " )
275+ self .py3_wrapper .log (f"received { data } " , level = "debug" )
286276 self .command_runner .run_command (data )
287277 finally :
288278 # Clean up the connection
0 commit comments