You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
889 B
51 lines
889 B
#ifndef HTTPD_LOGGING_H
|
|
#define HTTPD_LOGGING_H
|
|
|
|
#include <esp8266.h>
|
|
#include "uptime.h"
|
|
|
|
|
|
// logging functions
|
|
#define LOG_EOL "\n"
|
|
|
|
|
|
#define dbg(fmt, ...) \
|
|
do { \
|
|
uptime_print(); \
|
|
printf(" [ ] "fmt LOG_EOL, ##__VA_ARGS__); \
|
|
} while(0)
|
|
|
|
|
|
#define banner(fmt, ...) \
|
|
do { \
|
|
printf(LOG_EOL "\x1b[32;1m"); \
|
|
uptime_print(); \
|
|
printf(" [i] "fmt"\x1b[0m" LOG_EOL LOG_EOL, ##__VA_ARGS__); \
|
|
} while(0)
|
|
|
|
|
|
#define info(fmt, ...) \
|
|
do { \
|
|
printf("\x1b[32m"); \
|
|
uptime_print(); \
|
|
printf(" [i] "fmt"\x1b[0m"LOG_EOL, ##__VA_ARGS__); \
|
|
} while(0)
|
|
|
|
|
|
#define error(fmt, ...) \
|
|
do { \
|
|
printf("\x1b[31;1m"); \
|
|
uptime_print(); \
|
|
printf(" [E] "fmt"\x1b[0m"LOG_EOL, ##__VA_ARGS__); \
|
|
} while(0)
|
|
|
|
|
|
#define warn(fmt, ...) \
|
|
do { \
|
|
printf("\x1b[33;1m"); \
|
|
uptime_print(); \
|
|
printf(" [W] "fmt"\x1b[0m"LOG_EOL, ##__VA_ARGS__); \
|
|
} while(0)
|
|
|
|
|
|
#endif // HTTPD_LOGGING_H
|
|
|