iotjs icon indicating copy to clipboard operation
iotjs copied to clipboard

Debug message to console

Open seanshpark opened this issue 11 years ago • 3 comments

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 */

seanshpark avatar May 20 '15 11:05 seanshpark

For debug level, use environment variable for linux

export IOTJS_DEBUG_LEVEL=[1-3]
export IOTJS_DEBUG_LOGFILE=(absolute path to save the log)

seanshpark avatar May 21 '15 01:05 seanshpark

After it's merged, add to Wiki how to use.

seanshpark avatar May 21 '15 01:05 seanshpark

Closing as #40 landed

ILyoan avatar May 21 '15 02:05 ILyoan