OmEspHelpers
OmLog.h
1 /*
2  * OmLog.h
3  * 2016-12-13
4  *
5  * This class implements a simple console log
6  * utility. It's just like printf or
7  * Serial.printf, with some pretty printing.
8  *
9  * EXAMPLE
10  *
11  * OMLOG("a button was pressed: %d\n", buttonNumber);
12  *
13  * Which prints out like:
14  *
15  * 1200.22 (*) MySketch.ino.105: a button was pressed: 3
16  *
17  * The numbers on the left is a timestamp in seconds and hundredths.
18  */
19 
20 #ifndef __OmLog__
21 #define __OmLog__
22 
23 // just for IPAddress type.
24 #ifdef ARDUINO_ARCH_ESP8266
25 #include <ESP8266WiFi.h>
26 #endif
27 #ifdef ARDUINO_ARCH_ESP32
28 #include <WiFi.h>
29 #endif
30 #if NOT_ARDUINO
31 typedef unsigned char IPAddress[4];
32 #endif
33 
35 #define OMLOG(_args...) OmLog::logS(__FILE__, __LINE__, '*', _args)
36 
37 #define OMERR(_args...) OmLog::logS(__FILE__, __LINE__, 'E', _args)
38 
40 const char *ipAddressToString(IPAddress ip);
41 
42 class OmLog
43 {
44 public:
45  static void logS(const char *file, int line, char ch, const char *format, ...);
46 };
47 
48 #endif // __OmLog__
OmLog
Definition: OmLog.h:43