Skip to content

Commit 9681818

Browse files
committed
7k of savings for deleting all the logs.
Signed-off-by: Katharine Berry <[email protected]>
1 parent a6b7d96 commit 9681818

File tree

15 files changed

+107
-107
lines changed

15 files changed

+107
-107
lines changed

app/src/c/alarms/manager.c

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -59,25 +59,25 @@ void alarm_manager_init() {
5959

6060
int alarm_manager_add_alarm(time_t when, bool is_timer, char* name, bool conversational) {
6161
if (s_manager.pending_alarm_count >= MAX_ALARMS) {
62-
APP_LOG(APP_LOG_LEVEL_WARNING, "Not scheduling alarm because MAX_ALARMS (%d) was already reached.", MAX_ALARMS);
62+
//APP_LOG(APP_LOG_LEVEL_WARNING, "Not scheduling alarm because MAX_ALARMS (%d) was already reached.", MAX_ALARMS);
6363
return E_OUT_OF_RESOURCES;
6464
}
6565
WakeupId id = wakeup_schedule(when, when, true);
66-
APP_LOG(APP_LOG_LEVEL_INFO, "wakeup_schedule(%d, %d, true) -> %d", when, when, id);
66+
//APP_LOG(APP_LOG_LEVEL_INFO, "wakeup_schedule(%d, %d, true) -> %d", when, when, id);
6767
if (id == E_RANGE) {
68-
APP_LOG(APP_LOG_LEVEL_ERROR, "Scheduling alarm failed: E_RANGE (there's another event already scheduled then)");
68+
//APP_LOG(APP_LOG_LEVEL_ERROR, "Scheduling alarm failed: E_RANGE (there's another event already scheduled then)");
6969
return id;
7070
}
7171
if (id == E_INVALID_ARGUMENT) {
72-
APP_LOG(APP_LOG_LEVEL_ERROR, "Scheduling alarm failed: E_INVALID_ARGUMENT (the time is in the past)");
72+
//APP_LOG(APP_LOG_LEVEL_ERROR, "Scheduling alarm failed: E_INVALID_ARGUMENT (the time is in the past)");
7373
return id;
7474
}
7575
if (id == E_OUT_OF_RESOURCES) {
76-
APP_LOG(APP_LOG_LEVEL_ERROR, "Scheduling alarm failed: E_OUT_OF_RESOURCES (already eight alarms scheduled)");
76+
//APP_LOG(APP_LOG_LEVEL_ERROR, "Scheduling alarm failed: E_OUT_OF_RESOURCES (already eight alarms scheduled)");
7777
return id;
7878
}
7979
if (id < 0) {
80-
APP_LOG(APP_LOG_LEVEL_ERROR, "Scheduling alarm failed: %d (Pebble internal error)");
80+
//APP_LOG(APP_LOG_LEVEL_ERROR, "Scheduling alarm failed: %d (Pebble internal error)");
8181
return id;
8282
}
8383
Alarm* alarm = bmalloc(sizeof(Alarm));
@@ -187,7 +187,7 @@ static void prv_load_alarms() {
187187
int alarm_count = alarm_count_one < alarm_count_two ? alarm_count_one : alarm_count_two;
188188

189189
if (alarm_count == 0) {
190-
APP_LOG(APP_LOG_LEVEL_INFO, "No alarms known. Deleting all alarms to ensure consistency.");
190+
//APP_LOG(APP_LOG_LEVEL_INFO, "No alarms known. Deleting all alarms to ensure consistency.");
191191
wakeup_cancel_all();
192192
return;
193193
}
@@ -214,7 +214,7 @@ static void prv_load_alarms() {
214214
int j = 0;
215215
for (int i = 0; i < alarm_count; ++i) {
216216
if (!wakeup_query(wakeup_ids[i], NULL) && (!launched_for_wakeup || launch_id != wakeup_ids[i])) {
217-
APP_LOG(APP_LOG_LEVEL_WARNING, "Alarm %d (scheduled for %d) no longer exists; dropping.", wakeup_ids[i], times[i]);
217+
//APP_LOG(APP_LOG_LEVEL_WARNING, "Alarm %d (scheduled for %d) no longer exists; dropping.", wakeup_ids[i], times[i]);
218218
did_drop_entries = true;
219219
continue;
220220
}
@@ -236,14 +236,14 @@ static void prv_load_alarms() {
236236
s_manager.pending_alarm_count = j;
237237

238238
if (did_drop_entries) {
239-
APP_LOG(APP_LOG_LEVEL_INFO, "Updating saved data after dropping entries.");
239+
//APP_LOG(APP_LOG_LEVEL_INFO, "Updating saved data after dropping entries.");
240240
prv_save_alarms();
241241
}
242242
}
243243

244244
static void prv_save_alarms() {
245245
if (s_manager.pending_alarm_count == 0) {
246-
APP_LOG(APP_LOG_LEVEL_INFO, "No alarms to save. Deleting everything.");
246+
//APP_LOG(APP_LOG_LEVEL_INFO, "No alarms to save. Deleting everything.");
247247
persist_delete(PERSIST_KEY_ALARM_COUNT_ONE);
248248
persist_delete(PERSIST_KEY_ALARM_TIMES);
249249
persist_delete(PERSIST_KEY_ALARM_WAKEUP_IDS);
@@ -276,7 +276,7 @@ static void prv_save_alarms() {
276276
persist_write_data(PERSIST_KEY_ALARM_IS_TIMERS, &is_timers, sizeof(is_timers));
277277
persist_write_data(PERSIST_KEY_ALARM_NAMES, &names, sizeof(names));
278278
persist_write_int(PERSIST_KEY_ALARM_COUNT_TWO, s_manager.pending_alarm_count);
279-
APP_LOG(APP_LOG_LEVEL_INFO, "Wrote %d alarms.", s_manager.pending_alarm_count);
279+
//APP_LOG(APP_LOG_LEVEL_INFO, "Wrote %d alarms.", s_manager.pending_alarm_count);
280280
}
281281

282282
static void prv_remove_alarm(int to_remove) {
@@ -331,21 +331,21 @@ static void prv_remove_alarm(int to_remove) {
331331

332332
bool alarm_manager_maybe_alarm() {
333333
if (launch_reason() != APP_LAUNCH_WAKEUP) {
334-
APP_LOG(APP_LOG_LEVEL_DEBUG, "Not launched by APP_LAUNCH_WAKEUP");
334+
//APP_LOG(APP_LOG_LEVEL_DEBUG, "Not launched by APP_LAUNCH_WAKEUP");
335335
return false;
336336
}
337-
APP_LOG(APP_LOG_LEVEL_INFO, "Launched by APP_LAUNCH_WAKEUP");
337+
//APP_LOG(APP_LOG_LEVEL_INFO, "Launched by APP_LAUNCH_WAKEUP");
338338
WakeupId id;
339339
int32_t cookie;
340340
if (!wakeup_get_launch_event(&id, &cookie)) {
341341
return false;
342342
}
343-
APP_LOG(APP_LOG_LEVEL_INFO, "WakeupId: %d, cookie: %d", id, cookie);
343+
//APP_LOG(APP_LOG_LEVEL_INFO, "WakeupId: %d, cookie: %d", id, cookie);
344344
for (int i = 0; i < s_manager.pending_alarm_count; ++i) {
345345
Alarm* alarm = &s_manager.pending_alarms[i];
346-
APP_LOG(APP_LOG_LEVEL_INFO, "comparing %d == %d", alarm->wakeup_id, id);
346+
//APP_LOG(APP_LOG_LEVEL_INFO, "comparing %d == %d", alarm->wakeup_id, id);
347347
if (alarm->wakeup_id == id) {
348-
APP_LOG(APP_LOG_LEVEL_INFO, "alarm found! alarming...");
348+
//APP_LOG(APP_LOG_LEVEL_INFO, "alarm found! alarming...");
349349
alarm_window_push(alarm->scheduled_time, alarm->is_timer, alarm->name);
350350
prv_remove_alarm(i);
351351
return true;
@@ -389,18 +389,18 @@ static void prv_handle_set_alarm_request(DictionaryIterator *iterator, void *con
389389
StatusCode result = alarm_manager_add_alarm(alarm_time, is_timer, name, true);
390390
prv_send_alarm_response(result);
391391
if (result == S_SUCCESS) {
392-
APP_LOG(APP_LOG_LEVEL_INFO, "Set alarm for %d (is timer: %d)", alarm_time, is_timer);
392+
//APP_LOG(APP_LOG_LEVEL_INFO, "Set alarm for %d (is timer: %d)", alarm_time, is_timer);
393393
} else {
394-
APP_LOG(APP_LOG_LEVEL_ERROR, "Setting alarm for %d failed: %d", alarm_time, result);
394+
//APP_LOG(APP_LOG_LEVEL_ERROR, "Setting alarm for %d failed: %d", alarm_time, result);
395395
}
396396
}
397397

398398
static void prv_handle_get_alarm_request(int16_t is_timer, void* context) {
399399
DictionaryIterator *iter;
400-
APP_LOG(APP_LOG_LEVEL_INFO, "Retrieving alarms or possibly timers (%d).", is_timer);
400+
//APP_LOG(APP_LOG_LEVEL_INFO, "Retrieving alarms or possibly timers (%d).", is_timer);
401401
AppMessageResult result = app_message_outbox_begin(&iter);
402402
if (result != APP_MSG_OK) {
403-
APP_LOG(APP_LOG_LEVEL_ERROR, "Opening dict to respond failed: %d.", result);
403+
//APP_LOG(APP_LOG_LEVEL_ERROR, "Opening dict to respond failed: %d.", result);
404404
return;
405405
}
406406
int write_index = 0;
@@ -416,10 +416,10 @@ static void prv_handle_get_alarm_request(int16_t is_timer, void* context) {
416416
dict_write_int32(iter, MESSAGE_KEY_CURRENT_TIME, time(NULL));
417417
result = app_message_outbox_send();
418418
if (result != APP_MSG_OK) {
419-
APP_LOG(APP_LOG_LEVEL_ERROR, "Sending alarm list to phone failed: %d.", result);
419+
//APP_LOG(APP_LOG_LEVEL_ERROR, "Sending alarm list to phone failed: %d.", result);
420420
return;
421421
}
422-
APP_LOG(APP_LOG_LEVEL_INFO, "Sent alarm list.");
422+
//APP_LOG(APP_LOG_LEVEL_INFO, "Sent alarm list.");
423423
}
424424

425425
static void prv_handle_cancel_alarm_request(DictionaryIterator* iterator, void* context) {
@@ -469,25 +469,25 @@ static void prv_send_alarm_response(StatusCode response) {
469469
DictionaryIterator *iter;
470470
AppMessageResult result = app_message_outbox_begin(&iter);
471471
if (result != APP_MSG_OK) {
472-
APP_LOG(APP_LOG_LEVEL_ERROR, "Returning status code %d to phone failed in open: %d.", response, result);
472+
//APP_LOG(APP_LOG_LEVEL_ERROR, "Returning status code %d to phone failed in open: %d.", response, result);
473473
return;
474474
}
475475
dict_write_int32(iter, MESSAGE_KEY_SET_ALARM_RESULT, response);
476476
result = app_message_outbox_send();
477477
if (result != APP_MSG_OK) {
478-
APP_LOG(APP_LOG_LEVEL_ERROR, "Returning status code %d to phone failed in send: %d.", response, result);
478+
//APP_LOG(APP_LOG_LEVEL_ERROR, "Returning status code %d to phone failed in send: %d.", response, result);
479479
return;
480480
}
481-
APP_LOG(APP_LOG_LEVEL_INFO, "Sent alarm response %d", response);
481+
//APP_LOG(APP_LOG_LEVEL_INFO, "Sent alarm response %d", response);
482482
}
483483

484484
static void prv_wakeup_handler(WakeupId wakeup_id, int32_t cookie) {
485-
APP_LOG(APP_LOG_LEVEL_INFO, "it's the wakeup handler! (%d, %d)", wakeup_id, cookie);
485+
//APP_LOG(APP_LOG_LEVEL_INFO, "it's the wakeup handler! (%d, %d)", wakeup_id, cookie);
486486
for (int i = 0; i < s_manager.pending_alarm_count; ++i) {
487487
Alarm* alarm = &s_manager.pending_alarms[i];
488-
APP_LOG(APP_LOG_LEVEL_INFO, "comparing %d == %d", alarm->wakeup_id, wakeup_id);
488+
//APP_LOG(APP_LOG_LEVEL_INFO, "comparing %d == %d", alarm->wakeup_id, wakeup_id);
489489
if (alarm->wakeup_id == wakeup_id) {
490-
APP_LOG(APP_LOG_LEVEL_INFO, "alarm found! alarming...");
490+
//APP_LOG(APP_LOG_LEVEL_INFO, "alarm found! alarming...");
491491
alarm_window_push(alarm->scheduled_time, alarm->is_timer, alarm->name);
492492
prv_remove_alarm(i);
493493
break;

app/src/c/assistant.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static void prv_deinit(void) {
5353

5454
int main(void) {
5555
VersionInfo version_info = version_get_current();
56-
APP_LOG(APP_LOG_LEVEL_INFO, "Bobby %d.%d", version_info.major, version_info.minor);
56+
//APP_LOG(APP_LOG_LEVEL_INFO, "Bobby %d.%d", version_info.major, version_info.minor);
5757
prv_init();
5858

5959
if (alarm_manager_maybe_alarm()) {

app/src/c/consent/consent.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ void consent_migrate() {
8080
// If we're updating from version 1.1 or older, consent agreement was implied by LOCATION_ENABLED being set
8181
// (either true or false).
8282
if (version_info_compare(version_get_last_launch(), (VersionInfo) {1, 1}) <= 0) {
83-
APP_LOG(APP_LOG_LEVEL_INFO, "Performing consent migration from version 1.1.");
83+
//APP_LOG(APP_LOG_LEVEL_INFO, "Performing consent migration from version 1.1.");
8484
// If the location enabled state is set, that's equivalent to consent agreement version 1.
8585
if (persist_exists(PERSIST_KEY_LOCATION_ENABLED)) {
86-
APP_LOG(APP_LOG_LEVEL_INFO, "Marking consent as 1.");;
86+
//APP_LOG(APP_LOG_LEVEL_INFO, "Marking consent as 1.");;
8787
persist_write_int(PERSIST_KEY_CONSENTS_COMPLETED, 1);
8888
} else {
89-
APP_LOG(APP_LOG_LEVEL_INFO, "Not marking consent.");;
89+
//APP_LOG(APP_LOG_LEVEL_INFO, "Not marking consent.");;
9090
}
9191
}
9292
}
@@ -174,7 +174,7 @@ static void prv_set_stage(Window* window, int stage) {
174174
data->title_text = "Location";
175175
break;
176176
default:
177-
APP_LOG(APP_LOG_LEVEL_ERROR, "Unknown consent stage: %d", stage);
177+
//APP_LOG(APP_LOG_LEVEL_ERROR, "Unknown consent stage: %d", stage);
178178
return;
179179
}
180180
if (res_handle != NULL) {
@@ -210,7 +210,7 @@ static void prv_select_click_handler(ClickRecognizerRef recognizer, void *contex
210210
Window* window = context;
211211
ConsentWindowData *data = window_get_user_data(window);
212212
if (!prv_did_scroll_to_bottom(window)) {
213-
APP_LOG(APP_LOG_LEVEL_DEBUG, "User clicked select but hasn't scrolled to bottom; ignoring.");
213+
//APP_LOG(APP_LOG_LEVEL_DEBUG, "User clicked select but hasn't scrolled to bottom; ignoring.");
214214
return;
215215
}
216216
switch (data->stage) {
@@ -261,15 +261,15 @@ static void prv_app_message_handler(DictionaryIterator *iter, void *context) {
261261
Window* window = context;
262262
ConsentWindowData* data = window_get_user_data(window);
263263
if (data->expected_app_response != STAGE_LOCATION_CONSENT) {
264-
APP_LOG(APP_LOG_LEVEL_WARNING, "Ignoring unexpected location consent response.");
264+
//APP_LOG(APP_LOG_LEVEL_WARNING, "Ignoring unexpected location consent response.");
265265
return;
266266
}
267267
Tuple *tuple = dict_find(iter, MESSAGE_KEY_LOCATION_ENABLED);
268268
if (tuple == NULL) {
269269
return;
270270
}
271271
data->expected_app_response = 0;
272-
APP_LOG(APP_LOG_LEVEL_INFO, "Got location enabled reply, dismissing dialog.");
272+
//APP_LOG(APP_LOG_LEVEL_INFO, "Got location enabled reply, dismissing dialog.");
273273
events_app_message_unsubscribe(data->app_message_handle);
274274
bool location_enabled = tuple->value->int16;
275275
persist_write_bool(PERSIST_KEY_LOCATION_ENABLED, location_enabled);

app/src/c/converse/conversation.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ static void prv_append_to_response(ConversationResponse *response, const char* f
181181
while (response->len + len >= response->allocated) {
182182
response->allocated *= 2;
183183
char* new_resp = bmalloc(response->allocated);
184-
APP_LOG(APP_LOG_LEVEL_INFO, "Expanding buffer to %d bytes. New buffer: %p. Old buffer: %p.", response->allocated, new_resp, response->response);
184+
//APP_LOG(APP_LOG_LEVEL_INFO, "Expanding buffer to %d bytes. New buffer: %p. Old buffer: %p.", response->allocated, new_resp, response->response);
185185
strcpy(new_resp, response->response);
186-
APP_LOG(APP_LOG_LEVEL_INFO, "Copied %d bytes.", strlen(response->response) + 1);
186+
//APP_LOG(APP_LOG_LEVEL_INFO, "Copied %d bytes.", strlen(response->response) + 1);
187187
free(response->response);
188188
response->response = new_resp;
189189
}
@@ -219,7 +219,7 @@ bool conversation_add_response_fragment(Conversation* conversation, const char*
219219
void conversation_complete_response(Conversation *conversation) {
220220
ConversationResponse* response = prv_find_last_open_response(conversation);
221221
if (response == NULL) {
222-
APP_LOG(APP_LOG_LEVEL_WARNING, "Trying to complete a response, but couldn't find any.");
222+
//APP_LOG(APP_LOG_LEVEL_WARNING, "Trying to complete a response, but couldn't find any.");
223223
return;
224224
}
225225
response->complete = true;
@@ -266,15 +266,15 @@ void conversation_delete_first_entry(Conversation* conversation) {
266266

267267
ConversationEntry* conversation_entry_at_index(Conversation* conversation, int index) {
268268
if (index >= conversation->entry_count) {
269-
APP_LOG(APP_LOG_LEVEL_ERROR, "Caller asked for entry %d, but only %d exist.", index, conversation->entry_count);
269+
//APP_LOG(APP_LOG_LEVEL_ERROR, "Caller asked for entry %d, but only %d exist.", index, conversation->entry_count);
270270
return NULL;
271271
}
272272
return &conversation->entries[index];
273273
}
274274

275275
ConversationEntry* conversation_peek(Conversation* conversation) {
276276
if (conversation->entry_count == conversation->deleted_entries) {
277-
APP_LOG(APP_LOG_LEVEL_WARNING, "Tried to peek at conversation, but no entries yet.");
277+
//APP_LOG(APP_LOG_LEVEL_WARNING, "Tried to peek at conversation, but no entries yet.");
278278
return NULL;
279279
}
280280
return &conversation->entries[conversation->entry_count-1];
@@ -310,47 +310,47 @@ const char* prv_type_to_string(EntryType type) {
310310

311311
ConversationPrompt* conversation_entry_get_prompt(ConversationEntry* entry) {
312312
if (entry->type != EntryTypePrompt) {
313-
APP_LOG(APP_LOG_LEVEL_ERROR, "Asked for prompt %p, but it's actually a %s.", entry, prv_type_to_string(entry->type));
313+
//APP_LOG(APP_LOG_LEVEL_ERROR, "Asked for prompt %p, but it's actually a %s.", entry, prv_type_to_string(entry->type));
314314
return NULL;
315315
}
316316
return entry->content.prompt;
317317
}
318318

319319
ConversationResponse* conversation_entry_get_response(ConversationEntry* entry) {
320320
if (entry->type != EntryTypeResponse) {
321-
APP_LOG(APP_LOG_LEVEL_ERROR, "Asked for response %p, but it's actually a %s.", entry, prv_type_to_string(entry->type));
321+
//APP_LOG(APP_LOG_LEVEL_ERROR, "Asked for response %p, but it's actually a %s.", entry, prv_type_to_string(entry->type));
322322
return NULL;
323323
}
324324
return entry->content.response;
325325
}
326326

327327
ConversationThought* conversation_entry_get_thought(ConversationEntry* entry) {
328328
if (entry->type != EntryTypeThought) {
329-
APP_LOG(APP_LOG_LEVEL_ERROR, "Asked for thought %p, but it's actually a %s.", entry, prv_type_to_string(entry->type));
329+
//APP_LOG(APP_LOG_LEVEL_ERROR, "Asked for thought %p, but it's actually a %s.", entry, prv_type_to_string(entry->type));
330330
return NULL;
331331
}
332332
return entry->content.thought;
333333
}
334334

335335
ConversationError* conversation_entry_get_error(ConversationEntry* entry) {
336336
if (entry->type != EntryTypeError) {
337-
APP_LOG(APP_LOG_LEVEL_ERROR, "Asked for error %p, but it's actually a %s.", entry, prv_type_to_string(entry->type));
337+
//APP_LOG(APP_LOG_LEVEL_ERROR, "Asked for error %p, but it's actually a %s.", entry, prv_type_to_string(entry->type));
338338
return NULL;
339339
}
340340
return entry->content.error;
341341
}
342342

343343
ConversationAction* conversation_entry_get_action(ConversationEntry* action) {
344344
if (action->type != EntryTypeAction) {
345-
APP_LOG(APP_LOG_LEVEL_ERROR, "Asked for action %p, but it's actually a %s.", action, prv_type_to_string(action->type));
345+
//APP_LOG(APP_LOG_LEVEL_ERROR, "Asked for action %p, but it's actually a %s.", action, prv_type_to_string(action->type));
346346
return NULL;
347347
}
348348
return action->content.action;
349349
}
350350

351351
ConversationWidget* conversation_entry_get_widget(ConversationEntry* widget) {
352352
if (widget->type != EntryTypeWidget) {
353-
APP_LOG(APP_LOG_LEVEL_ERROR, "Asked for widget %p, but it's actually a %s.", widget, prv_type_to_string(widget->type));
353+
//APP_LOG(APP_LOG_LEVEL_ERROR, "Asked for widget %p, but it's actually a %s.", widget, prv_type_to_string(widget->type));
354354
return NULL;
355355
}
356356
return widget->content.widget;
@@ -361,7 +361,7 @@ EntryType conversation_entry_get_type(ConversationEntry* entry) {
361361
}
362362

363363
void conversation_set_thread_id(Conversation* conversation, const char* thread_id) {
364-
APP_LOG(APP_LOG_LEVEL_INFO, "Thread ID updated: %s", thread_id);
364+
//APP_LOG(APP_LOG_LEVEL_INFO, "Thread ID updated: %s", thread_id);
365365
strncpy(conversation->thread_id, thread_id, 37);
366366
}
367367

0 commit comments

Comments
 (0)