From a37bdc4870dee16f637a5c354e9034d53da403fd Mon Sep 17 00:00:00 2001 From: Tobias Reisinger Date: Thu, 20 Aug 2020 23:31:01 +0200 Subject: [PATCH] add: more debug logging --- CMakeLists.txt | 2 +- src/models/controller_load.c | 2 ++ src/models/controller_save.c | 2 ++ src/models/relay_load.c | 2 ++ src/models/relay_save.c | 2 ++ src/models/schedule_load.c | 2 ++ src/models/schedule_save.c | 2 ++ 7 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 823d536..49b059d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.7) project(controller - VERSION 0.2.9 + VERSION 0.2.10 LANGUAGES C) add_executable(controller src/main.c) diff --git a/src/models/controller_load.c b/src/models/controller_load.c index 310362d..0b9da30 100644 --- a/src/models/controller_load.c +++ b/src/models/controller_load.c @@ -32,6 +32,8 @@ controller_load(MDB_env *mdb_env) controller_t *new_controller; + LOGGER_DEBUG("loading controller\n"); + if((err = mdb_txn_begin(mdb_env, NULL, MDB_RDONLY, &mdb_txn)) != 0) { LOGGER_ERR("mdb_txn_begin error %s\n", mdb_strerror(err)); diff --git a/src/models/controller_save.c b/src/models/controller_save.c index 27e5604..59457f8 100644 --- a/src/models/controller_save.c +++ b/src/models/controller_save.c @@ -34,6 +34,8 @@ controller_save(controller_t *controller, MDB_env *mdb_env) MDB_dbi mdb_dbi; MDB_val value; + LOGGER_DEBUG("saving controller\n"); + if((err = mdb_txn_begin(mdb_env, NULL, 0, &mdb_txn)) != 0) { LOGGER_ERR("mdb_txn_begin error %s\n", mdb_strerror(err)); diff --git a/src/models/relay_load.c b/src/models/relay_load.c index 4c755c7..8186092 100644 --- a/src/models/relay_load.c +++ b/src/models/relay_load.c @@ -43,6 +43,8 @@ relay_load(MDB_env *mdb_env, uint8_t num) relay_t *new_relay; + LOGGER_DEBUG("loading relay %d\n", num); + if((err = mdb_txn_begin(mdb_env, NULL, MDB_RDONLY, &mdb_txn)) != 0) { LOGGER_ERR("mdb_txn_begin error %s\n", mdb_strerror(err)); diff --git a/src/models/relay_save.c b/src/models/relay_save.c index 4950226..86b4714 100644 --- a/src/models/relay_save.c +++ b/src/models/relay_save.c @@ -43,6 +43,8 @@ relay_save(relay_t *relay, MDB_env *mdb_env) MDB_dbi mdb_dbi; MDB_val value; + LOGGER_DEBUG("saving relay %d\n", relay->number); + if((err = mdb_txn_begin(mdb_env, NULL, 0, &mdb_txn)) != 0) { LOGGER_ERR("mdb_txn_begin error %s\n", mdb_strerror(err)); diff --git a/src/models/schedule_load.c b/src/models/schedule_load.c index 4186080..ccfde1a 100644 --- a/src/models/schedule_load.c +++ b/src/models/schedule_load.c @@ -49,6 +49,8 @@ schedule_load(MDB_env *mdb_env, uint8_t relay_num, uint8_t weekday) memset(off_id, 0, sizeof(uuid_t)); memcpy(off_id, "off", 3); + LOGGER_DEBUG("loading schedule %d for relay %d\n", weekday, relay_num); + if((err = mdb_txn_begin(mdb_env, NULL, MDB_RDONLY, &mdb_txn)) != 0) { LOGGER_ERR("mdb_txn_begin error %s\n", mdb_strerror(err)); diff --git a/src/models/schedule_save.c b/src/models/schedule_save.c index 94a989c..c742c7a 100644 --- a/src/models/schedule_save.c +++ b/src/models/schedule_save.c @@ -48,6 +48,8 @@ schedule_save(schedule_t *schedule, uint8_t relay_num, MDB_env *mdb_env) MDB_dbi mdb_dbi; MDB_val value; + LOGGER_DEBUG("saving schedule %d for relay %d\n", schedule->weekday, relay_num); + if((err = mdb_txn_begin(mdb_env, NULL, 0, &mdb_txn)) != 0) { LOGGER_ERR("mdb_txn_begin error %s\n", mdb_strerror(err));