Skip to content

Commit d01b275

Browse files
committed
Move some logs to debug level and add more logging
1 parent c47b411 commit d01b275

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

CalendarHarmony.gs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ function sync() {
140140
var primaryEventsUpdated = []; // to contain primary calendar events that were updated from secondary calendar
141141
var primaryEventsCreated = []; // to contain primary calendar events that were created from secondary calendar
142142

143-
log('Number of primaryEvents: ' + primaryEvents.length);
144-
log('Number of secondaryEvents: ' + secondaryEvents.length);
143+
debug('Number of primaryEvents: ' + primaryEvents.length);
144+
debug('Number of secondaryEvents: ' + secondaryEvents.length);
145145

146146
// create filtered list of existing primary calendar events that were previously created from the secondary calendar
147147
for each (var pEvent in primaryEvents)
@@ -161,28 +161,32 @@ function sync() {
161161
// Skip adding non-blocking (free, versus busy) all-day events
162162
if (sEvent.end.date != null && sEvent.transparency == 'transparent')
163163
{
164-
log("Nonblocking All Day!: " + sEvent.summary + " => " + sEvent.id + " @ " + sEvent.end.date);
164+
debug("Nonblocking All Day!: " + sEvent.summary + " => " + sEvent.id + " @ " + sEvent.end.date);
165165
continue;
166166
}
167167

168168
// if the secondary event has already been blocked in the primary calendar, update it
169169
if ((pEvent = primaryEventsFiltered[sId]) != null)
170170
{
171171
delete primaryEventsFiltered[sId];
172-
log("Updating: " + sEvent.summary + " => " + sEvent.id + " @ " + sEvent.start.dateTime);
172+
debug("Updating: " + sEvent.summary + " => " + sEvent.id + " @ " + sEvent.start.dateTime);
173173
updateEvent(pEvent, sEvent);
174174
} else {
175175
if (!weekdays_only || is_on_weekday(sEvent)) {
176-
log("Creating: " + sEvent.summary + " => " + sEvent.id + " @ " + sEvent.start.dateTime);
176+
debug("Creating: " + sEvent.summary + " => " + sEvent.id + " @ " + sEvent.start.dateTime);
177177
pEvent = createEvent(sEvent, primaryCalendar);
178178
}
179179
}
180180
}
181181

182+
log("Processed Events: " + secondaryEvents.length);
183+
182184
// if a primary event previously created no longer exists in the secondary calendar, delete it
183185
for each (var pEvent in primaryEventsFiltered)
184186
{
185-
log("Deleting: " + pEvent.summary + " => " + pEvent.id + " @ " + pEvent.start.dateTime);
187+
debug("Deleting: " + pEvent.summary + " => " + pEvent.id + " @ " + pEvent.start.dateTime);
186188
Calendar.Events.remove(primaryCalendar.getId(), pEvent.id);
187189
}
190+
191+
log("Deleted Events: " + primaryEventsFiltered.length);
188192
}

Events.gs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function copyEvent(event) {
4141
visibility: 'private'
4242
};
4343
data.extendedProperties.shared[calendarId] = event.id
44-
Logger.log(JSON.stringify(data));
44+
debug(JSON.stringify(data));
4545
return data;
4646
}
4747

0 commit comments

Comments
 (0)