summaryrefslogtreecommitdiff
path: root/fw/app/src
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2025-04-15 18:06:32 +0200
committerxengineering <me@xengineering.eu>2025-04-15 18:06:32 +0200
commit0bff2eea39c11b5ad2e762325abeb1457ae0fd7e (patch)
treeba0f8ee394897fc0fc0e96f8566ec6f3924a7514 /fw/app/src
parent698832f42c11d1df2b955de37b6b130c980dadce (diff)
downloadiot-contact-0bff2eea39c11b5ad2e762325abeb1457ae0fd7e.tar
iot-contact-0bff2eea39c11b5ad2e762325abeb1457ae0fd7e.tar.zst
iot-contact-0bff2eea39c11b5ad2e762325abeb1457ae0fd7e.zip
fw: app: syslog: Implement commit target
Diffstat (limited to 'fw/app/src')
-rw-r--r--fw/app/src/settings.c2
-rw-r--r--fw/app/src/syslog.c16
2 files changed, 9 insertions, 9 deletions
diff --git a/fw/app/src/settings.c b/fw/app/src/settings.c
index 916c7ad..799322e 100644
--- a/fw/app/src/settings.c
+++ b/fw/app/src/settings.c
@@ -30,4 +30,4 @@ int init_settings(void) {
return 0;
}
-SYS_INIT(init_settings, APPLICATION, 40);
+SYS_INIT(init_settings, APPLICATION, 50);
diff --git a/fw/app/src/syslog.c b/fw/app/src/syslog.c
index 6dc0bd6..8fe2412 100644
--- a/fw/app/src/syslog.c
+++ b/fw/app/src/syslog.c
@@ -85,10 +85,6 @@ int init_syslog(void)
/* flush log messages to ensure first syslog message is reproducible */
while (log_process());
log_backend_init(backend);
- LOG_INF("Setting syslog target to: '%s'", target_ip);
- if (log_backend_net_set_addr(target_ip) == false) {
- LOG_ERR("Could not set target IP to '%s'", target_ip);
- }
log_backend_enable(backend, backend->cb->ctx, CONFIG_LOG_MAX_LEVEL);
LOG_INF("Syslog backend enabled");
} else {
@@ -97,7 +93,7 @@ int init_syslog(void)
return 0;
}
-SYS_INIT(init_syslog, APPLICATION, 50);
+SYS_INIT(init_syslog, APPLICATION, 40);
int syslog_handle_set(const char *name, size_t len, settings_read_cb read_cb,
void *cb_arg)
@@ -108,10 +104,10 @@ int syslog_handle_set(const char *name, size_t len, settings_read_cb read_cb,
memset(target_ip, '\0', sizeof(target_ip));
ssize_t ret = read_cb(cb_arg, target_ip, MIN(sizeof(target_ip) - 1, len));
if (ret < 0) {
- LOG_ERR("Failed to read syslog/target/ip setting (%d)", ret);
+ LOG_ERR("Failed to set target (%d)", ret);
return (int)ret;
}
- LOG_INF("Setting target IP address to '%s'", target_ip);
+ LOG_INF("Set target to '%s'", target_ip);
return 0;
}
@@ -120,7 +116,11 @@ int syslog_handle_set(const char *name, size_t len, settings_read_cb read_cb,
int syslog_handle_commit(void)
{
- LOG_WRN("Settings commit not implemented");
+ if (log_backend_net_set_addr(target_ip) == false) {
+ LOG_ERR("Could not commit target to '%s'", target_ip);
+ }
+ LOG_INF("Committed new target: '%s'", target_ip);
+
return 0;
}