Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions deps/message-port/async-uv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ size_t AsyncUV::EnqueueTask(Task task) {
bool AsyncUV::DrainPendingTasks(uv_loop_t* loop) {
TRACE(MSGPORT, "DrainPendingTasks");
std::lock_guard<std::mutex> 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");
Expand All @@ -81,7 +81,7 @@ bool AsyncUV::DrainPendingTasks(uv_loop_t* loop) {
void AsyncUV::DeletePendingTasks() {
TRACE(MSGPORT, "DeletePendingTasks");
std::lock_guard<std::mutex> lock(queue_mutex_);
TRACE(MSGPORT, "delete pending tasks", queue_.size());
TRACE(MSGPORT, "delete pending tasks %zu", queue_.size());
if (!queue_.empty()) {
std::queue<Task> empty;
std::swap(queue_, empty);
Expand Down
23 changes: 11 additions & 12 deletions deps/message-port/nd/es-helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ OptionalRef<StringRef> 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;
}
Expand All @@ -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) {
Expand Down Expand Up @@ -528,19 +528,19 @@ 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 =
ExceptionHelper::CreateErrorObject(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;
}

Expand All @@ -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;
}
Expand Down Expand Up @@ -592,7 +592,6 @@ std::string ExecResultHelper::GetStackTraceString(
const GCManagedVector<Evaluator::StackTraceData>& traceData,
const std::string& reasonString,
size_t max_stack_size) {
TRACE(ERROR, KV(traceData.size()));
const std::string separator = " ";
std::ostringstream oss;

Expand Down
47 changes: 19 additions & 28 deletions deps/message-port/nd/nd-logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <dlog.h>
#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
Expand Down
4 changes: 2 additions & 2 deletions src/lwnode/nd-mod-message-port.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down