add: more debug logs
This commit is contained in:
		
							parent
							
								
									c7d7d36ef8
								
							
						
					
					
						commit
						3d7245c16c
					
				
					 7 changed files with 10 additions and 3 deletions
				
			
		| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
cmake_minimum_required (VERSION 3.7)
 | 
					cmake_minimum_required (VERSION 3.7)
 | 
				
			||||||
project(core
 | 
					project(core
 | 
				
			||||||
        VERSION 0.2.8
 | 
					        VERSION 0.2.9
 | 
				
			||||||
        LANGUAGES C)
 | 
					        LANGUAGES C)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
add_executable(core src/main.c)
 | 
					add_executable(core src/main.c)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -66,6 +66,7 @@ cache_insert_value(char *key, char *value)
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
cache_invalidate(char *key)
 | 
					cache_invalidate(char *key)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    LOGGER_DEBUG("invalidating %s\n", key);
 | 
				
			||||||
    sqlite3_stmt *stmt;
 | 
					    sqlite3_stmt *stmt;
 | 
				
			||||||
    int rc;
 | 
					    int rc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -168,7 +168,7 @@ api_v1_controllers_STR_relays_INT_PUT(struct mg_connection *nc, struct http_mess
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            schedule_free(relay->schedules[schedule_position]);
 | 
					            schedule_free(relay->schedules[schedule_position]);
 | 
				
			||||||
            relay->schedules[schedule_position] = schedule_get_by_uid_or_off(target_uid);
 | 
					            relay->schedules[schedule_position] = schedule_get_by_uid_or_off(target_uid);
 | 
				
			||||||
            LOGGER_DEBUG("new schedule[%d]: %s\n", schedule_position, relay->schedules[schedule_position]);
 | 
					            LOGGER_DEBUG("new schedule[%d]: %s\n", schedule_position, relay->schedules[schedule_position]->name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ++schedule_position;
 | 
					            ++schedule_position;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -197,7 +197,7 @@ api_v1_controllers_STR_relays_INT_PUT(struct mg_connection *nc, struct http_mess
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            relay->schedules[day_of_week] = schedule_get_by_uid_or_off(target_uid);
 | 
					            relay->schedules[day_of_week] = schedule_get_by_uid_or_off(target_uid);
 | 
				
			||||||
            LOGGER_DEBUG("new active schedule: %s\n", relay->schedules[day_of_week]);
 | 
					            LOGGER_DEBUG("new active schedule: %s\n", relay->schedules[day_of_week]->name);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,6 +13,7 @@
 | 
				
			||||||
static int
 | 
					static int
 | 
				
			||||||
db_update_insert(controller_t *controller, sqlite3_stmt *stmt)
 | 
					db_update_insert(controller_t *controller, sqlite3_stmt *stmt)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    LOGGER_DEBUG("saving controller '%s' into database (id: %d)\n", controller->name, controller->id);
 | 
				
			||||||
    int rc;
 | 
					    int rc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    sqlite3_bind_int(stmt, 1, controller->id);
 | 
					    sqlite3_bind_int(stmt, 1, controller->id);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,6 +17,7 @@
 | 
				
			||||||
static int
 | 
					static int
 | 
				
			||||||
db_update_insert(relay_t *relay, sqlite3_stmt *stmt)
 | 
					db_update_insert(relay_t *relay, sqlite3_stmt *stmt)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    LOGGER_DEBUG("saving relay '%s' into database (id: %d)\n", relay->name, relay->id);
 | 
				
			||||||
    int rc;
 | 
					    int rc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    sqlite3_bind_int(stmt, 1, relay->id);
 | 
					    sqlite3_bind_int(stmt, 1, relay->id);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,6 +13,8 @@
 | 
				
			||||||
static int
 | 
					static int
 | 
				
			||||||
db_update_insert(schedule_t *schedule, sqlite3_stmt *stmt)
 | 
					db_update_insert(schedule_t *schedule, sqlite3_stmt *stmt)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    LOGGER_DEBUG("saving schedule '%s' into database (id: %d)\n", schedule->name, schedule->id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int rc;
 | 
					    int rc;
 | 
				
			||||||
    uint16_t *periods_blob = schedule_periods_to_blob(schedule);
 | 
					    uint16_t *periods_blob = schedule_periods_to_blob(schedule);
 | 
				
			||||||
    int blob_size = (int)sizeof(uint16_t) * ((periods_blob[0] * 2) + 1);
 | 
					    int blob_size = (int)sizeof(uint16_t) * ((periods_blob[0] * 2) + 1);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,6 +10,8 @@
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
tag_save(int id, const char *tag)
 | 
					tag_save(int id, const char *tag)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    LOGGER_DEBUG("saving tag '%s' into database (id: %d)\n", tag, id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int rc;
 | 
					    int rc;
 | 
				
			||||||
    sqlite3_stmt *stmt;
 | 
					    sqlite3_stmt *stmt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue