iotjs
iotjs copied to clipboard
Debug message to console
Need debug message logging like in JerryScript
- https://github.com/Samsung/jerryscript/pull/79
+#ifdef JERRY_ENABLE_LOG
+#define JERRY_LOG(lvl, ...) \
+ do \
+ { \
+ if (lvl <= jerry_debug_level && jerry_log_file) \
+ { \
+ fprintf (jerry_log_file, __VA_ARGS__); \
+ } \
+ } \
+ while (0)
+
+#define JERRY_DLOG(...) JERRY_LOG (1, __VA_ARGS__)
+#define JERRY_DDLOG(...) JERRY_LOG (2, __VA_ARGS__)
+#define JERRY_DDDLOG(...) JERRY_LOG (3, __VA_ARGS__)
+#else /* !JERRY_ENABLE_LOG */
+#define JERRY_DLOG(...) \
+ do \
+ { \
+ if (false) \
+ { \
+ jerry_ref_unused_variables (0, __VA_ARGS__); \
+ } \
+ } while (0)
+#define JERRY_DDLOG(...) JERRY_DLOG (__VA_ARGS__)
+#define JERRY_DDDLOG(...) JERRY_DLOG (__VA_ARGS__)
+#endif /* !JERRY_ENABLE_LOG */
For debug level, use environment variable for linux
export IOTJS_DEBUG_LEVEL=[1-3]
export IOTJS_DEBUG_LOGFILE=(absolute path to save the log)
After it's merged, add to Wiki how to use.
Closing as #40 landed