Inherits StreamHandler.
Custom StreamHandler which intercepts and stores all
received logs from python std logging module until they
are all uploaded to Coretex API
Definition at line 90 of file logger.py.
◆ flushLogs()
bool coretex.logging.logger.LogHandler.flushLogs |
( |
|
self | ) |
|
Uploads all currently stored logs to Coretex backend
Returns
-------
bool -> True if the upload is successful, False otherwise
Definition at line 149 of file logger.py.
149 def flushLogs(self) -> bool:
151 Uploads all currently stored logs to Coretex backend
155 bool -> True if the upload is successful, False otherwise
158 if len(self.__pendingLogs) == 0:
161 if self.currentExperimentId
is None:
162 self.__pendingLogs.clear()
165 snapshot = copy.copy(self.__pendingLogs)
167 response = networkManager.genericJSONRequest(
168 endpoint =
"model-queue/add-console-log",
169 requestType = RequestType.post,
171 "model_queue_id": self.currentExperimentId,
172 "logs": [log.encode()
for log
in snapshot]
177 if not response.hasFailed():
178 self.__clearLogs(snapshot)
180 return not response.hasFailed()
◆ reset()
None coretex.logging.logger.LogHandler.reset |
( |
|
self | ) |
|
Resets the internal state of the LogHandler
Clears all pending logs
Resets the upload worker thread
Definition at line 182 of file logger.py.
182 def reset(self) -> None:
184 Resets the internal state of the LogHandler
185 Clears all pending logs
186 Resets the upload worker thread
189 self.currentExperimentId =
None
190 self.__pendingLogs.clear()
191 self.__uploadWorker.reset()
The documentation for this class was generated from the following file: