diff --git a/deps/message-port/async-uv.cc b/deps/message-port/async-uv.cc index 216aa675bc..9a1b462e52 100644 --- a/deps/message-port/async-uv.cc +++ b/deps/message-port/async-uv.cc @@ -63,7 +63,7 @@ size_t AsyncUV::EnqueueTask(Task task) { bool AsyncUV::DrainPendingTasks(uv_loop_t* loop) { TRACE(MSGPORT, "DrainPendingTasks"); std::lock_guard lock(queue_mutex_); - TRACE(MSGPORT, "drain pending tasks", queue_.size()); + TRACE(MSGPORT, "drain pending tasks %zu", queue_.size()); if (loop == nullptr) { TRACE(MSGPORT, "invalid loop"); @@ -81,7 +81,7 @@ bool AsyncUV::DrainPendingTasks(uv_loop_t* loop) { void AsyncUV::DeletePendingTasks() { TRACE(MSGPORT, "DeletePendingTasks"); std::lock_guard lock(queue_mutex_); - TRACE(MSGPORT, "delete pending tasks", queue_.size()); + TRACE(MSGPORT, "delete pending tasks %zu", queue_.size()); if (!queue_.empty()) { std::queue empty; std::swap(queue_, empty); diff --git a/deps/message-port/nd/es-helper.cc b/deps/message-port/nd/es-helper.cc index da24cb2151..44ede89fa9 100644 --- a/deps/message-port/nd/es-helper.cc +++ b/deps/message-port/nd/es-helper.cc @@ -138,7 +138,7 @@ OptionalRef BuiltinHelperFileRead( state.get(), StringRef::createFromASCII("invalid file name"))); } } else { - TRACE(ESCARGOT, "File Not Found:", file_name); + TRACE(ESCARGOT, "File Not Found: %s", file_name); } return nullptr; } @@ -161,7 +161,7 @@ ValueRef* BuiltinLoad(ExecutionStateRef* state, // path CHECK(argv[0]->isString()); file_name = argv[0]->toString(state)->toStdUTF8String(); - TRACE(LOADER, KV(file_name)); + TRACE(LOADER, "file_name: %s", file_name.c_str()); // useEmptyContext if (argc > 1) { @@ -528,9 +528,9 @@ ExecResult CompileAndExecution(ContextRef* context, break; } - TRACEF(ESCARGOT, - "Compile: %s", - compile_result.parseErrorMessage->toStdUTF8String()); + TRACE(ESCARGOT, + "Compile: %s", + compile_result.parseErrorMessage->toStdUTF8String().c_str()); Evaluator::EvaluatorResult result; result.error = @@ -538,9 +538,9 @@ ExecResult CompileAndExecution(ContextRef* context, compile_result.parseErrorCode, compile_result.parseErrorMessage); - TRACEF(ESCARGOT, - "Compile: %s", - result.resultOrErrorToString(context)->toStdUTF8String().c_str()); + TRACE(ESCARGOT, + "Compile: %s", + result.resultOrErrorToString(context)->toStdUTF8String().c_str()); return result; } @@ -552,9 +552,9 @@ ExecResult CompileAndExecution(ContextRef* context, }, compile_result.script.get()); if (execute_result.isSuccessful() == false) { - TRACEF(ESCARGOT, - "\nExecute:\n%s", - ExecResultHelper::GetErrorString(context, execute_result).c_str()); + TRACE(ESCARGOT, + "\nExecute:\n%s", + ExecResultHelper::GetErrorString(context, execute_result).c_str()); } return execute_result; } @@ -592,7 +592,6 @@ std::string ExecResultHelper::GetStackTraceString( const GCManagedVector& traceData, const std::string& reasonString, size_t max_stack_size) { - TRACE(ERROR, KV(traceData.size())); const std::string separator = " "; std::ostringstream oss; diff --git a/deps/message-port/nd/nd-logger.h b/deps/message-port/nd/nd-logger.h index e37773798c..b755da002b 100644 --- a/deps/message-port/nd/nd-logger.h +++ b/deps/message-port/nd/nd-logger.h @@ -58,47 +58,38 @@ enum LOG_PRIORITY { #if !defined(ENABLE_TRACE) #define TRACE(id, ...) -#define TRACE0(id, ...) -#define TRACEF(id, ...) -#define TRACEF0(id, ...) #define S0(x) #define KV(x) #else - -#define TRACE(id, ...) \ +#if defined(HOST_TIZEN) +#include +#define TRACE(id, fmt, ...) \ do { \ if (IsTraceEnabled(#id)) { \ - Print(LOG_PRIO_DEBUG, \ - #id, \ - CreateCodeLocation(__PRETTY_FUNCTION__, __FILE_NAME__, __LINE__), \ - ##__VA_ARGS__); \ + dlog_print(DLOG_INFO, \ + "LWNODE", \ + "%s: (%s:%d) > [MessagePort] " fmt, \ + __FUNCTION__, \ + __FILE_NAME__, \ + __LINE__, \ + ##__VA_ARGS__); \ } \ } while (0) - -#define TRACEF(id, ...) \ +#else +#define TRACE(id, fmt, ...) \ do { \ if (IsTraceEnabled(#id)) { \ - PrintF(LOG_PRIO_DEBUG, \ - #id, \ - CreateCodeLocation(__PRETTY_FUNCTION__, __FILE_NAME__, __LINE__), \ + printf(DLOG_INFO, \ + "LWNODE", \ + " %s: (%s:%d) > [MessagePort] " fmt, \ + __FUNCTION__, \ + __FILE_NAME__, \ + __LINE__, \ ##__VA_ARGS__); \ } \ } while (0) - -#define TRACE0(id, ...) \ - do { \ - if (IsTraceEnabled(#id)) { \ - Print(LOG_PRIO_DEBUG, #id, "", ##__VA_ARGS__); \ - } \ - } while (0) - -#define TRACEF0(id, ...) \ - do { \ - if (IsTraceEnabled(#id)) { \ - PrintF(LOG_PRIO_DEBUG, #id, "", ##__VA_ARGS__); \ - } \ - } while (0) +#endif #define S0(x) #x ":" #define KV(x) S0(x), x diff --git a/src/lwnode/nd-mod-message-port.cc b/src/lwnode/nd-mod-message-port.cc index 7ccbd375db..942c5d7d68 100644 --- a/src/lwnode/nd-mod-message-port.cc +++ b/src/lwnode/nd-mod-message-port.cc @@ -139,7 +139,7 @@ class MessagePortWrap : public BaseObject { MessagePortWrap(ObjectRef* object) : BaseObject(object) { onmessage_ = ValueRef::createUndefined(); } - ~MessagePortWrap() { TRACE(MSGPORT_JS, "DELETE", this); } + ~MessagePortWrap() { TRACE(MSGPORT_JS, "DELETE %p", this); } static ValueRef* New(ExecutionStateRef* state, ValueRef* this_value, @@ -218,7 +218,7 @@ class MessagePortWrap : public BaseObject { // Start listening messages port->OnMessage([this, context](const MessageEvent* event) { - TRACEF(MSGPORT_JS, "OnMessage: %s\n", event->data()); + TRACE(MSGPORT_JS, "OnMessage: %s\n", event->data().c_str()); if (!onmessage_->isFunctionObject()) { return;