From 37c675c04189cdb9f5ce95e628eb8d0fdec13c0d Mon Sep 17 00:00:00 2001 From: jonasbjurel Date: Wed, 16 Aug 2023 12:14:44 +0200 Subject: [PATCH] Added an option to not automatically instantiate a Log object. In some cases you do not want the Log object to be instantiated automatically by the library. Reasons could be that you want to control the heap memory segment type that gets allocated for the log object, or that you want to inherit the log base to another derived class. This commit adds a flag "__DO_NOT_INSTANTIATE__" that if set omits the automatic instantiation. The change is backwards compatible. --- ArduinoLog.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ArduinoLog.cpp b/ArduinoLog.cpp index c4075fe..b9085d4 100644 --- a/ArduinoLog.cpp +++ b/ArduinoLog.cpp @@ -262,5 +262,8 @@ void Logging::printFormat(const char format, va_list *args) { } #endif } - + +#ifndef __DO_NOT_INSTANTIATE__ Logging Log = Logging(); +#endif +