MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / log

Method log

web/pgadmin/misc/bgprocess/process_executor.py:191–229  ·  view source on GitHub ↗

This function will update log file Args: msg: message (bytes from subprocess) Returns: None

(self, msg)

Source from the content-addressed store, hash-verified

189 self.stream = stream
190
191 def log(self, msg):
192 """
193 This function will update log file
194
195 Args:
196 msg: message (bytes from subprocess)
197
198 Returns:
199 None
200 """
201 # Write into log file
202 if self.logger:
203 if msg:
204 self.logger.write(
205 get_current_time(
206 format='%y%m%d%H%M%S%f'
207 ).encode('utf-8')
208 )
209 self.logger.write(b',')
210
211 # Convert subprocess output from system encoding to UTF-8
212 # This fixes garbled text on Windows with non-UTF-8 locales
213 # (e.g., Japanese CP932, Chinese GBK)
214 msg = msg.lstrip(b'\r\n' if _IS_WIN else b'\n')
215 if _subprocess_encoding and \
216 _subprocess_encoding.lower() not in ('utf-8', 'utf8'):
217 try:
218 msg = msg.decode(
219 _subprocess_encoding, 'replace'
220 ).encode('utf-8')
221 except (UnicodeDecodeError, LookupError):
222 # If decoding fails, write as-is
223 pass
224
225 self.logger.write(msg)
226 self.logger.write(os.linesep.encode('utf-8'))
227
228 return True
229 return False
230
231 def run(self):
232 if self.process and self.stream:

Callers 14

runMethod · 0.95
reset_cursor_atMethod · 0.80
execute_scalarMethod · 0.80
execute_asyncMethod · 0.80
execute_voidMethod · 0.80
execute_2darrayMethod · 0.80
execute_dictMethod · 0.80
pollMethod · 0.80
status_messageMethod · 0.80
parsePlanFunction · 0.80

Calls 3

decodeMethod · 0.80
get_current_timeFunction · 0.70
writeMethod · 0.45

Tested by 1

writeMethod · 0.64