Skip to content

Commit 9ca38cc

Browse files
committed
feat: add setDlogID api
Signed-off-by: Hosung Kim [email protected]
1 parent 54fbcaa commit 9ca38cc

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

deps/node/src/lwnode/lwnode-public.cc

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,25 @@ bool InitScriptRootPath(const std::string path) {
5656
return true;
5757
}
5858

59+
void SetDlogID(const std::string& tag) {
60+
#if defined(HOST_TIZEN) && !defined(LWNODE_TIZEN_AUL)
61+
if (!tag.empty()) {
62+
LogKind::user()->tag = tag;
63+
}
64+
65+
LogOption::setDefaultOutputInstantiator([]() {
66+
static thread_local std::shared_ptr<Logger::Output> s_loggerOutput;
67+
if (s_loggerOutput == nullptr) {
68+
s_loggerOutput =
69+
std::static_pointer_cast<Logger::Output>(std::make_shared<DlogOut>());
70+
}
71+
return s_loggerOutput;
72+
});
73+
#endif
74+
}
75+
5976
int Start(int argc, char** argv) {
6077
return node::Start(argc, argv);
6178
}
6279

63-
} // namespace LWNode
80+
} // namespace lwnode

include/lwnode/lwnode-public.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ LWNODE_EXPORT bool ParseAULEvent(int argc, char** argv);
3232
// function.
3333
LWNODE_EXPORT bool InitScriptRootPath(const std::string path = "");
3434

35+
// Sets the dlog tag id for debugging. This is only used on Tizen when not in AUL mode.
36+
LWNODE_EXPORT void SetDlogID(const std::string& appId);
37+
3538
LWNODE_EXPORT int Start(int argc, char** argv);
3639

3740
} // namespace lwnode

0 commit comments

Comments
 (0)