bmsd/fermenters.c

changeset 852
71f0fa38b634
parent 799
cf145b35d65f
--- a/bmsd/fermenters.c	Tue Oct 17 11:54:38 2023 +0200
+++ b/bmsd/fermenters.c	Wed Oct 18 10:06:11 2023 +0200
@@ -3,7 +3,7 @@
  * @brief Handle fermenters status
  * @author Michiel Broek <mbroek at mbse dot eu>
  *
- * Copyright (C) 2018-2022
+ * Copyright (C) 2018-2023
  *
  * This file is part of the bms (Brewery Management System)
  *
@@ -818,13 +818,12 @@
 
 void fermenter_log(char *topic, char *payload)
 {
-    char                *edge_node, *alias, *line, buf[65], *logfile, *query = malloc(512);
+    char                *edge_node, *alias, *query = malloc(512);
     struct json_object  *jobj, *val, *metric, *metric2;
     fermentation_log	*log;
     bool		trigger = false;
     struct tm		*mytime;
     time_t		timestamp;
-    FILE		*fp;
 
     strtok(topic, "/"); // ignore namespace
     strtok(NULL, "/");	// group_id
@@ -948,77 +947,6 @@
     }
     free(query);
 
-    /*
-     * Build csv log line. Used by the web client.
-     */
-    line = xstrcpy(log->datetime);
-    line = xstrcat(line, (char *)",");
-    line = xstrcat(line, log->mode);
-    line = xstrcat(line, (char *)",");
-    line = xstrcat(line, log->stage);
-    line = xstrcat(line, (char *)",");
-    snprintf(buf, 64, "%.3f", log->temperature_air);
-    line = xstrcat(line, buf);
-    line = xstrcat(line, (char *)",");
-    snprintf(buf, 64, "%.3f", log->temperature_beer);
-    line = xstrcat(line, buf);
-    line = xstrcat(line, (char *)",");
-    snprintf(buf, 64, "%.3f", log->temperature_chiller);
-    line = xstrcat(line, buf);
-    line = xstrcat(line, (char *)",");
-    snprintf(buf, 64, "%.3f", log->temperature_room);
-    line = xstrcat(line, buf);
-    line = xstrcat(line, (char *)",");
-    snprintf(buf, 64, "%.1f", log->setpoint_low);
-    line = xstrcat(line, buf);
-    line = xstrcat(line, (char *)",");
-    snprintf(buf, 64, "%.1f", log->setpoint_high);
-    line = xstrcat(line, buf);
-    line = xstrcat(line, (char *)",");
-    snprintf(buf, 64, "%d", log->heater_power);
-    line = xstrcat(line, buf);
-    line = xstrcat(line, (char *)",");
-    snprintf(buf, 64, "%ld", log->heater_usage);
-    line = xstrcat(line, buf);
-    line = xstrcat(line, (char *)",");
-    snprintf(buf, 64, "%d", log->cooler_power);
-    line = xstrcat(line, buf);
-    line = xstrcat(line, (char *)",");
-    snprintf(buf, 64, "%ld", log->cooler_usage);
-    line = xstrcat(line, buf);
-    line = xstrcat(line, (char *)",");
-    if (log->event)
-	line = xstrcat(line, log->event);
-    line = xstrcat(line, (char *)",");
-    if (log->fermenter_uuid)
-	line = xstrcat(line, log->fermenter_uuid);
-
-    /*
-     * Build logfile name
-     */
-    logfile = xstrcpy(Config.web_root);
-    logfile = xstrcat(logfile, (char *)"/log/fermentation/");
-    logfile = xstrcat(logfile, log->product_code);
-    logfile = xstrcat(logfile, (char *)" ");
-    logfile = xstrcat(logfile, log->product_name);
-    logfile = xstrcat(logfile, (char *)".log");
-
-    if (debug)
-	fprintf(stdout, "%s %s\n", logfile, line);
-
-    fp = fopen(logfile, "a");
-    if (fp) {
-	fprintf(fp, "%s\n", line);
-	fclose(fp);
-    } else {
-	syslog(LOG_NOTICE, "cannot append to `%s'", logfile);
-    }
-
-    free(logfile);
-    logfile = NULL;
-    free(line);
-    line = NULL;
-
     if (log->datetime)
     	free(log->datetime);
     if (log->product_uuid )

mercurial