add: more debug logging

This commit is contained in:
Tobias Reisinger 2020-08-20 23:31:01 +02:00
parent d4ba7177d1
commit a37bdc4870
7 changed files with 13 additions and 1 deletions

View file

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.7) cmake_minimum_required (VERSION 3.7)
project(controller project(controller
VERSION 0.2.9 VERSION 0.2.10
LANGUAGES C) LANGUAGES C)
add_executable(controller src/main.c) add_executable(controller src/main.c)

View file

@ -32,6 +32,8 @@ controller_load(MDB_env *mdb_env)
controller_t *new_controller; controller_t *new_controller;
LOGGER_DEBUG("loading controller\n");
if((err = mdb_txn_begin(mdb_env, NULL, MDB_RDONLY, &mdb_txn)) != 0) if((err = mdb_txn_begin(mdb_env, NULL, MDB_RDONLY, &mdb_txn)) != 0)
{ {
LOGGER_ERR("mdb_txn_begin error %s\n", mdb_strerror(err)); LOGGER_ERR("mdb_txn_begin error %s\n", mdb_strerror(err));

View file

@ -34,6 +34,8 @@ controller_save(controller_t *controller, MDB_env *mdb_env)
MDB_dbi mdb_dbi; MDB_dbi mdb_dbi;
MDB_val value; MDB_val value;
LOGGER_DEBUG("saving controller\n");
if((err = mdb_txn_begin(mdb_env, NULL, 0, &mdb_txn)) != 0) if((err = mdb_txn_begin(mdb_env, NULL, 0, &mdb_txn)) != 0)
{ {
LOGGER_ERR("mdb_txn_begin error %s\n", mdb_strerror(err)); LOGGER_ERR("mdb_txn_begin error %s\n", mdb_strerror(err));

View file

@ -43,6 +43,8 @@ relay_load(MDB_env *mdb_env, uint8_t num)
relay_t *new_relay; relay_t *new_relay;
LOGGER_DEBUG("loading relay %d\n", num);
if((err = mdb_txn_begin(mdb_env, NULL, MDB_RDONLY, &mdb_txn)) != 0) if((err = mdb_txn_begin(mdb_env, NULL, MDB_RDONLY, &mdb_txn)) != 0)
{ {
LOGGER_ERR("mdb_txn_begin error %s\n", mdb_strerror(err)); LOGGER_ERR("mdb_txn_begin error %s\n", mdb_strerror(err));

View file

@ -43,6 +43,8 @@ relay_save(relay_t *relay, MDB_env *mdb_env)
MDB_dbi mdb_dbi; MDB_dbi mdb_dbi;
MDB_val value; MDB_val value;
LOGGER_DEBUG("saving relay %d\n", relay->number);
if((err = mdb_txn_begin(mdb_env, NULL, 0, &mdb_txn)) != 0) if((err = mdb_txn_begin(mdb_env, NULL, 0, &mdb_txn)) != 0)
{ {
LOGGER_ERR("mdb_txn_begin error %s\n", mdb_strerror(err)); LOGGER_ERR("mdb_txn_begin error %s\n", mdb_strerror(err));

View file

@ -49,6 +49,8 @@ schedule_load(MDB_env *mdb_env, uint8_t relay_num, uint8_t weekday)
memset(off_id, 0, sizeof(uuid_t)); memset(off_id, 0, sizeof(uuid_t));
memcpy(off_id, "off", 3); 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) if((err = mdb_txn_begin(mdb_env, NULL, MDB_RDONLY, &mdb_txn)) != 0)
{ {
LOGGER_ERR("mdb_txn_begin error %s\n", mdb_strerror(err)); LOGGER_ERR("mdb_txn_begin error %s\n", mdb_strerror(err));

View file

@ -48,6 +48,8 @@ schedule_save(schedule_t *schedule, uint8_t relay_num, MDB_env *mdb_env)
MDB_dbi mdb_dbi; MDB_dbi mdb_dbi;
MDB_val value; 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) if((err = mdb_txn_begin(mdb_env, NULL, 0, &mdb_txn)) != 0)
{ {
LOGGER_ERR("mdb_txn_begin error %s\n", mdb_strerror(err)); LOGGER_ERR("mdb_txn_begin error %s\n", mdb_strerror(err));