Monitor for central heating system (e.g. 2zones+hw) Supports up to 15 temp probes (DS18B20/DS18S20) 3 valve monitors Gas pulse meter recording Use stand-alone or with nodeEnergyServer See http://robdobson.com/2015/09/central-heating-monitor
Dependencies: EthernetInterfacePlusHostname NTPClient Onewire RdWebServer SDFileSystem-RTOS mbed-rtos mbed-src
Logger.h@20:7933076df5af, 2015-10-13 (annotated)
- Committer:
- Bobty
- Date:
- Tue Oct 13 18:35:20 2015 +0000
- Revision:
- 20:7933076df5af
- Parent:
- 12:a52996515063
Improved logging and added a mutex to avoid clashes on SD card access
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Bobty | 12:a52996515063 | 1 | // Log to SD |
Bobty | 12:a52996515063 | 2 | // Rob Dobson, 2015 |
Bobty | 12:a52996515063 | 3 | |
Bobty | 12:a52996515063 | 4 | #ifndef __LOGGER__H |
Bobty | 12:a52996515063 | 5 | #define __LOGGER__H |
Bobty | 12:a52996515063 | 6 | #include "mbed.h" |
Bobty | 12:a52996515063 | 7 | #include <stdarg.h> |
Bobty | 20:7933076df5af | 8 | #include "rtos.h" |
Bobty | 12:a52996515063 | 9 | |
Bobty | 12:a52996515063 | 10 | class Logger |
Bobty | 12:a52996515063 | 11 | { |
Bobty | 12:a52996515063 | 12 | public: |
Bobty | 20:7933076df5af | 13 | Logger(const char* eventLogFileName, const char* dataLogFileBase, Mutex &sdCardMutex); |
Bobty | 12:a52996515063 | 14 | void LogEvent(const char* format, ...); |
Bobty | 12:a52996515063 | 15 | void LogData(const char* format, ...); |
Bobty | 20:7933076df5af | 16 | void LogDebug(const char* format, ...); |
Bobty | 20:7933076df5af | 17 | void SetDebugDest(bool logToFile, bool logToConsole) |
Bobty | 20:7933076df5af | 18 | { |
Bobty | 20:7933076df5af | 19 | _logDebugToFile = logToFile; |
Bobty | 20:7933076df5af | 20 | _logDebugToConsole = logToConsole; |
Bobty | 20:7933076df5af | 21 | }; |
Bobty | 12:a52996515063 | 22 | |
Bobty | 12:a52996515063 | 23 | private: |
Bobty | 12:a52996515063 | 24 | const char* _eventLogFileName; |
Bobty | 12:a52996515063 | 25 | const char* _dataLogFileBase; |
Bobty | 20:7933076df5af | 26 | bool _logDebugToFile; |
Bobty | 20:7933076df5af | 27 | bool _logDebugToConsole; |
Bobty | 20:7933076df5af | 28 | Mutex &_sdCardMutex; |
Bobty | 12:a52996515063 | 29 | }; |
Bobty | 12:a52996515063 | 30 | |
Bobty | 12:a52996515063 | 31 | |
Bobty | 12:a52996515063 | 32 | #endif |