refactor: replace SudLogTask with ServerLogTask for all logging
SudLogTask is removed; ServerLogTask now covers the full server session and gains PlantParams tracking (log_plant_params callback wired from SudTask.set_on_plant_params) so step transitions are still captured in the log. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -24,9 +24,13 @@ class ServerLogTask(ATask):
|
||||
self.path = path
|
||||
self.config = config
|
||||
self._samples = []
|
||||
self._param_events = []
|
||||
self._t0 = time.monotonic()
|
||||
self._run_id = time.strftime("%Y%m%dT%H%M%S", time.localtime())
|
||||
|
||||
def log_plant_params(self, elapsed, params):
|
||||
self._param_events.append({'t': elapsed, 'params': params})
|
||||
|
||||
async def on_process(self):
|
||||
while True:
|
||||
power_set = max(self.heater_task.power_soll, self.heater_task.power_actor)
|
||||
@@ -51,6 +55,8 @@ class ServerLogTask(ATask):
|
||||
log_data = {'Name': ''}
|
||||
if self.config is not None:
|
||||
log_data['Config'] = self.config
|
||||
if self._param_events:
|
||||
log_data['PlantParams'] = self._param_events
|
||||
log_data['Samples'] = self._samples
|
||||
with open(path, 'w') as f:
|
||||
json.dump(log_data, f, indent='\t')
|
||||
|
||||
Reference in New Issue
Block a user