Skip to content

Commit 48c9bac

Browse files
committed
chore: Enable logging earlier in examples
1 parent a4b00a8 commit 48c9bac

File tree

5 files changed

+45
-5
lines changed

5 files changed

+45
-5
lines changed

examples/ArduinoIoTCloud-Advanced/ArduinoIoTCloud-Advanced.ino

+9-1
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,21 @@ void setup() {
1717
Serial.begin(9600);
1818
for(unsigned long const serialBeginTime = millis(); !Serial && (millis() - serialBeginTime <= 5000); ) { }
1919

20+
/* Set the debug message level:
21+
* - DBG_ERROR: Only show error messages
22+
* - DBG_WARNING: Show warning and error messages
23+
* - DBG_INFO: Show info, warning, and error messages
24+
* - DBG_DEBUG: Show debug, info, warning, and error messages
25+
* - DBG_VERBOSE: Show all messages
26+
*/
27+
setDebugMessageLevel(DBG_INFO);
28+
2029
/* This function takes care of connecting your sketch variables to the ArduinoIoTCloud object */
2130
initProperties();
2231

2332
/* Initialize Arduino IoT Cloud library */
2433
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
2534

26-
setDebugMessageLevel(DBG_INFO);
2735
ArduinoCloud.printDebugInfo();
2836
}
2937

examples/ArduinoIoTCloud-Basic/ArduinoIoTCloud-Basic.ino

+9-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ void setup() {
2525
Serial.begin(9600);
2626
for(unsigned long const serialBeginTime = millis(); !Serial && (millis() - serialBeginTime <= 5000); ) { }
2727

28+
/* Set the debug message level:
29+
* - DBG_ERROR: Only show error messages
30+
* - DBG_WARNING: Show warning and error messages
31+
* - DBG_INFO: Show info, warning, and error messages
32+
* - DBG_DEBUG: Show debug, info, warning, and error messages
33+
* - DBG_VERBOSE: Show all messages
34+
*/
35+
setDebugMessageLevel(DBG_INFO);
36+
2837
/* Configure LED pin as an output */
2938
pinMode(LED_BUILTIN, OUTPUT);
3039

@@ -34,7 +43,6 @@ void setup() {
3443
/* Initialize Arduino IoT Cloud library */
3544
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
3645

37-
setDebugMessageLevel(DBG_INFO);
3846
ArduinoCloud.printDebugInfo();
3947
}
4048

examples/ArduinoIoTCloud-Callbacks/ArduinoIoTCloud-Callbacks.ino

+9-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ void setup() {
3333
Serial.begin(9600);
3434
for(unsigned long const serialBeginTime = millis(); !Serial && (millis() - serialBeginTime <= 5000); ) { }
3535

36+
/* Set the debug message level:
37+
* - DBG_ERROR: Only show error messages
38+
* - DBG_WARNING: Show warning and error messages
39+
* - DBG_INFO: Show info, warning, and error messages
40+
* - DBG_DEBUG: Show debug, info, warning, and error messages
41+
* - DBG_VERBOSE: Show all messages
42+
*/
43+
setDebugMessageLevel(DBG_INFO);
44+
3645
/* This function takes care of connecting your sketch variables to the ArduinoIoTCloud object */
3746
initProperties();
3847

@@ -51,7 +60,6 @@ void setup() {
5160
ArduinoCloud.addCallback(ArduinoIoTCloudEvent::SYNC, doThisOnSync);
5261
ArduinoCloud.addCallback(ArduinoIoTCloudEvent::DISCONNECT, doThisOnDisconnect);
5362

54-
setDebugMessageLevel(DBG_INFO);
5563
ArduinoCloud.printDebugInfo();
5664
}
5765

examples/ArduinoIoTCloud-DeferredOTA/ArduinoIoTCloud-DeferredOTA.ino

+9-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ void setup() {
5858
Serial.begin(9600);
5959
for(unsigned long const serialBeginTime = millis(); !Serial && (millis() - serialBeginTime <= 5000); ) { }
6060

61+
/* Set the debug message level:
62+
* - DBG_ERROR: Only show error messages
63+
* - DBG_WARNING: Show warning and error messages
64+
* - DBG_INFO: Show info, warning, and error messages
65+
* - DBG_DEBUG: Show debug, info, warning, and error messages
66+
* - DBG_VERBOSE: Show all messages
67+
*/
68+
setDebugMessageLevel(DBG_INFO);
69+
6170
/* Configure LED pin as an output */
6271
pinMode(LED_BUILTIN, OUTPUT);
6372

@@ -70,7 +79,6 @@ void setup() {
7079
/* Setup OTA callback */
7180
ArduinoCloud.onOTARequestCb(onOTARequestCallback);
7281

73-
setDebugMessageLevel(DBG_INFO);
7482
ArduinoCloud.printDebugInfo();
7583
}
7684

examples/ArduinoIoTCloud-Schedule/ArduinoIoTCloud-Schedule.ino

+9-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ void setup() {
1717
Serial.begin(9600);
1818
for(unsigned long const serialBeginTime = millis(); !Serial && (millis() - serialBeginTime <= 5000); ) { }
1919

20+
/* Set the debug message level:
21+
* - DBG_ERROR: Only show error messages
22+
* - DBG_WARNING: Show warning and error messages
23+
* - DBG_INFO: Show info, warning, and error messages
24+
* - DBG_DEBUG: Show debug, info, warning, and error messages
25+
* - DBG_VERBOSE: Show all messages
26+
*/
27+
setDebugMessageLevel(DBG_INFO);
28+
2029
/* Configure LED pin as an output */
2130
pinMode(LED_BUILTIN, OUTPUT);
2231

@@ -26,7 +35,6 @@ void setup() {
2635
/* Initialize Arduino IoT Cloud library */
2736
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
2837

29-
setDebugMessageLevel(DBG_INFO);
3038
ArduinoCloud.printDebugInfo();
3139

3240
/* Setup one shot schedule example */

0 commit comments

Comments
 (0)