Skip to content

Commit 9824e77

Browse files
committed
Merge branch 'release/1.0.6'
2 parents 057c894 + 1721c05 commit 9824e77

File tree

5 files changed

+74
-37
lines changed

5 files changed

+74
-37
lines changed

CHANGELOG.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,25 @@ All notable changes to this project will be documented in this file. Dates are d
44

55
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
66

7+
#### [1.0.6](https://github.com/rdkcentral/rdkNativeScript/compare/1.0.5...1.0.6)
8+
9+
- RDKEMW-8240 : Add logs in jsruntime.log in /opt/logs [`#60`](https://github.com/rdkcentral/rdkNativeScript/pull/60)
10+
- Merge tag '1.0.5' into develop [`0bae809`](https://github.com/rdkcentral/rdkNativeScript/commit/0bae809fc9bb8a69156798e07b15cade4c526431)
11+
712
#### [1.0.5](https://github.com/rdkcentral/rdkNativeScript/compare/1.0.4...1.0.5)
813

14+
> 15 September 2025
15+
916
- RDKEMW-8240 : Add logs in jsruntime.log in /opt/logs [`#57`](https://github.com/rdkcentral/rdkNativeScript/pull/57)
17+
- 1.0.5 release changelog updates [`bd46b16`](https://github.com/rdkcentral/rdkNativeScript/commit/bd46b16959b0b828e09154fdd5c8f8b72ea989cc)
1018
- Merge tag '1.0.4' into develop [`ad6b6ee`](https://github.com/rdkcentral/rdkNativeScript/commit/ad6b6ee37cb5c76239a29e10c053e054e90b25df)
1119

1220
#### [1.0.4](https://github.com/rdkcentral/rdkNativeScript/compare/1.0.3...1.0.4)
1321

1422
> 7 September 2025
1523
1624
- RDKEMW-7489: Adding Href support [`#54`](https://github.com/rdkcentral/rdkNativeScript/pull/54)
17-
- RDKEMW-5556: Bug for terminateApplication [`#51`](https://github.com/rdkcentral/rdkNativeScript/pull/51)
25+
- Ticket:RDKEMW-5556: Bug for terminateApplication [`#51`](https://github.com/rdkcentral/rdkNativeScript/pull/51)
1826
- 1.0.4 release changelog updates [`2e56742`](https://github.com/rdkcentral/rdkNativeScript/commit/2e56742d0adda04fe61277fa0782e2b5b2dde19c)
1927
- Merge tag '1.0.3' into develop [`e15828d`](https://github.com/rdkcentral/rdkNativeScript/commit/e15828d5a330b072753e682f5c446b0f9ae14531)
2028

@@ -37,9 +45,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
3745
- RDKEMW-4729:Add support for clearMeasures [`#33`](https://github.com/rdkcentral/rdkNativeScript/pull/33)
3846
- RDKEMW-3466 : JSRuntimeWidget [`#32`](https://github.com/rdkcentral/rdkNativeScript/pull/32)
3947
- RDKEMW-4353:Implement logs to remain [`#29`](https://github.com/rdkcentral/rdkNativeScript/pull/29)
40-
- RDKEMW-4353:Bug when set DEBUG level [`#28`](https://github.com/rdkcentral/rdkNativeScript/pull/28)
41-
- RDKEMW-4278:Update launchTime metrics [`#27`](https://github.com/rdkcentral/rdkNativeScript/pull/27)
42-
- RDKEMW-4353:Implement logs to remain [`32f6cf1`](https://github.com/rdkcentral/rdkNativeScript/commit/32f6cf11af9c786d34334838ff75065fbd0d70cf)
48+
- Ticket Number:RDKEMW-4353:Bug when set DEBUG level [`#28`](https://github.com/rdkcentral/rdkNativeScript/pull/28)
49+
- Ticket Number:RDKEMW-4278:Update launchTime metrics [`#27`](https://github.com/rdkcentral/rdkNativeScript/pull/27)
50+
- Ticket Number:RDKEMW-4353:Implement logs to remain [`32f6cf1`](https://github.com/rdkcentral/rdkNativeScript/commit/32f6cf11af9c786d34334838ff75065fbd0d70cf)
4351
- 1.0.2 release changelog updates [`bd89254`](https://github.com/rdkcentral/rdkNativeScript/commit/bd89254c510cbd92accda18c4df5fa8d7221615f)
4452
- RDKEMW-4729: Code cleanup for window change [`9162e1c`](https://github.com/rdkcentral/rdkNativeScript/commit/9162e1cc2b8c7a19c41a7420e19f05786df4899e)
4553

@@ -49,12 +57,12 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
4957
5058
- RDKEMW-3457 : WebSocket IPC [`#24`](https://github.com/rdkcentral/rdkNativeScript/pull/24)
5159
- RDKEMW-3523:Update rdkNativeScript with application identifiers [`#20`](https://github.com/rdkcentral/rdkNativeScript/pull/20)
52-
- RDKEMW-3430: Implementing log levels [`#22`](https://github.com/rdkcentral/rdkNativeScript/pull/22)
60+
- Ticket Number:RDKEMW-3430: Implementing log levels [`#22`](https://github.com/rdkcentral/rdkNativeScript/pull/22)
5361
- RDKEMW-3105 : Add ability to show network connections with details [`#18`](https://github.com/rdkcentral/rdkNativeScript/pull/18)
54-
- RDKEMW-3557:-Metrics for launchtime [`#19`](https://github.com/rdkcentral/rdkNativeScript/pull/19)
62+
- Ticket Number :RDKEMW-3557:-Metrics for launchtime [`#19`](https://github.com/rdkcentral/rdkNativeScript/pull/19)
5563
- RDKEMW-2175 : Run player within jsruntime plugin via dynamic load of … [`#16`](https://github.com/rdkcentral/rdkNativeScript/pull/16)
56-
- RDKEMW-3523:Update rdkNativeScript with interface API's [`60fc51b`](https://github.com/rdkcentral/rdkNativeScript/commit/60fc51b6f48272e9671bc787c68a2ce19b036e0c)
57-
- RDKEMW-3557:Metrics for launch time [`eca1c15`](https://github.com/rdkcentral/rdkNativeScript/commit/eca1c15b2e98e40156dba22696325c2c5d5fbaa5)
64+
- 3523:Update rdkNativeScript with interface API's [`60fc51b`](https://github.com/rdkcentral/rdkNativeScript/commit/60fc51b6f48272e9671bc787c68a2ce19b036e0c)
65+
- Ticket Number:RDKEMW-3557:Metrics for launch time [`eca1c15`](https://github.com/rdkcentral/rdkNativeScript/commit/eca1c15b2e98e40156dba22696325c2c5d5fbaa5)
5866
- 1.0.1 release changelog updates [`e60bbb2`](https://github.com/rdkcentral/rdkNativeScript/commit/e60bbb2b72c74a43c34af35179d4b619fd9ac779)
5967

6068
#### 1.0.0

CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ option(ENABLE_AAMP_JSBINDINGS_DYNAMIC "ENABLE_AAMP_JSBINDINGS_DYNAMIC" OFF)
3838
option(ENABLE_JSRUNTIME_PLAYER "ENABLE_JSRUNTIME_PLAYER" OFF)
3939
option(ENABLE_JSRUNTIME_THUNDER_SECURITYAGENT "ENABLE_JSRUNTIME_THUNDER_SECURITYAGENT" OFF)
4040
option(BUILD_JSRUNTIME_DESKTOP "BUILD_JSRUNTIME_DESKTOP" ON)
41+
option(USE_ETHANLOG "USE_ETHANLOG" OFF)
4142
option(PKG_CONFIG_SYSROOT_DIR "PKG_CONFIG_SYSROOT_DIR" "${CMAKE_CURRENT_SOURCE_DIR}/externals/extlibs")
4243

4344
if(JSRUNTIME_ENGINE_NAME STREQUAL "jsc")
@@ -158,21 +159,27 @@ else ()
158159
set(JSRUNTIME_LIBRARY_LINK_DIRECTORIES ${JSRUNTIME_LIBRARY_LINK_DIRECTORIES} -L${CMAKE_CURRENT_SOURCE_DIR}/../build/)
159160
endif (BUILD_JSRUNTIME_DESKTOP)
160161

162+
if (USE_ETHANLOG)
163+
message("Enabling Ethan logs")
164+
add_definitions("-DUSE_ETHANLOG")
165+
set(JSRUNTIME_LINK_ETHANLIB -lethanlog)
166+
endif (USE_ETHANLOG)
167+
161168
if (BUILD_JSRUNTIME_APP)
162169
message("Enabling build support for jsruntime app")
163170
add_executable(jsruntime_app ${JSRUNTIME_APP_FILES})
164171
add_dependencies(${JSRUNTIME_LIBRARY_NAME} ${JSRUNTIME_ENGINE_DEPENDENT_LIBRARY_NAME})
165172
add_dependencies(jsruntime_app ${JSRUNTIME_LIBRARY_NAME} ${JSRUNTIME_ENGINE_DEPENDENT_LIBRARY_NAME} )
166173
target_include_directories(jsruntime_app PRIVATE ${JSRUNTIME_INCLUDE_DIRECTORIES})
167174
set_target_properties(jsruntime_app PROPERTIES OUTPUT_NAME ${EXE})
168-
target_link_libraries(jsruntime_app ${JSRUNTIME_LIBRARY_LINK_DIRECTORIES} -l${JSRUNTIME_LIBRARY_NAME} ${JSRUNTIME_LINK_LIBRARIES})
175+
target_link_libraries(jsruntime_app ${JSRUNTIME_LIBRARY_LINK_DIRECTORIES} -l${JSRUNTIME_LIBRARY_NAME} ${JSRUNTIME_LINK_LIBRARIES} ${JSRUNTIME_LINK_ETHANLIB})
169176
endif (BUILD_JSRUNTIME_APP)
170177

171178
if (BUILD_JSRUNTIME_CLIENT)
172179
add_executable(jsruntime_client ${JSRUNTIME_CLIENT_FILES})
173180
target_include_directories(jsruntime_client PRIVATE ${JSRUNTIME_INCLUDE_DIRECTORIES})
174181
set_target_properties(jsruntime_client PROPERTIES OUTPUT_NAME "JSRuntimeClient")
175-
target_link_libraries(jsruntime_client ${JSRUNTIME_LIBRARY_LINK_DIRECTORIES} -lpthread)
182+
target_link_libraries(jsruntime_client ${JSRUNTIME_LIBRARY_LINK_DIRECTORIES} ${JSRUNTIME_LINK_ETHANLIB} -lpthread)
176183
endif (BUILD_JSRUNTIME_CLIENT)
177184

178185
set(UWEBSOCKETS_TARGET "Linux")

include/NativeJSLogger.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ class NativeJSLogger
3232
{
3333
public:
3434
static void setLogLevel(const char* loglevel);
35+
static void isEthanLogEnabled();
3536
static void log(LogLevel level, const char* format, ...);
3637
private:
3738
static LogLevel sLogLevel;
39+
static bool mEthanLogEnabled;
3840
};
3941

4042
#endif // NATIVEJS_LOGGER_H

src/NativeJSLogger.cpp

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,27 @@
2424
#include <unistd.h>
2525
#include <sys/syscall.h>
2626
#include <stdlib.h>
27-
#include <time.h>
27+
28+
#ifdef USE_ETHANLOG
29+
#include <ethanlog.h>
30+
31+
static const int ethanLogLevelMap[] = {
32+
ETHAN_LOG_DEBUG, ETHAN_LOG_INFO, ETHAN_LOG_WARNING, ETHAN_LOG_ERROR, ETHAN_LOG_FATAL
33+
};
34+
#endif
2835

2936
static const char* logLevelNames[] = {
3037
"DEBUG", "INFO", "WARN", "ERROR", "FATAL"
3138
};
3239

40+
3341
LogLevel NativeJSLogger::sLogLevel = INFO;
42+
bool NativeJSLogger::mEthanLogEnabled = false;
43+
44+
void NativeJSLogger::isEthanLogEnabled()
45+
{
46+
mEthanLogEnabled = (getenv("ETHAN_LOGGING_PIPE") != nullptr);
47+
}
3448

3549
void NativeJSLogger::setLogLevel(const char* loglevel)
3650
{
@@ -50,35 +64,36 @@ void NativeJSLogger::setLogLevel(const char* loglevel)
5064

5165
void NativeJSLogger::log(LogLevel level, const char* format, ...)
5266
{
53-
if (level < sLogLevel)
54-
return;
55-
56-
FILE* logFile = fopen("/opt/logs/jsruntime.log", "a");
57-
if (!logFile) {
58-
perror("Failed to open jsruntime.log");
59-
return;
60-
}
67+
if (level < sLogLevel)
68+
return;
6169

62-
char timeStr[64];
63-
time_t now = time(NULL);
64-
struct tm* t = localtime(&now);
65-
strftime(timeStr, sizeof(timeStr), "%Y-%m-%d %H:%M:%S", t);
70+
va_list args;
71+
va_start(args, format);
72+
int threadId = syscall(__NR_gettid);
6673

67-
int threadId = syscall(__NR_gettid);
68-
const char* levelStr = logLevelNames[level];
69-
char buffer[512];
74+
#ifdef USE_ETHANLOG
75+
if (mEthanLogEnabled)
76+
{
77+
int ethanLogLevel = ethanLogLevelMap[level];
78+
char* newFormat = nullptr;
79+
int len = snprintf(nullptr, 0, "JSRuntime [Thread-%d] %s", threadId, format);
80+
if (len > 0) {
81+
newFormat = (char*)alloca(len + 1);
82+
snprintf(newFormat, len + 1, "JSRuntime [Thread-%d] %s", threadId, format);
83+
} else {
84+
newFormat = (char*)format;
85+
}
7086

71-
va_list args;
72-
va_start(args, format);
73-
vsnprintf(buffer, sizeof(buffer), format, args);
74-
va_end(args);
87+
vethanlog(ethanLogLevel, "JsRuntime", nullptr, -1, newFormat, args);
88+
}
89+
#else
90+
91+
const char* levelStr = logLevelNames[level];
92+
char buffer[512];
93+
vsnprintf(buffer, sizeof(buffer), format, args);
94+
printf("\n[%s] JsRuntime Thread-%d: %s\n", levelStr, threadId, buffer);
7595

76-
if(getenv("NATIVEJS_LOGS_REG"))
77-
printf("\n[%s] JsRuntime Thread-%d: %s\n", levelStr, threadId, buffer);
78-
else
79-
fprintf(logFile, "%s : [%s] JsRuntime Thread-%d: %s\n", timeStr, levelStr, threadId, buffer);
80-
81-
fclose(logFile);
96+
#endif //USE_ETHANLOG
8297

98+
va_end(args);
8399
}
84-

src/NativeJSRenderer.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ NativeJSRenderer::NativeJSRenderer(std::string waylandDisplay): mEngine(nullptr)
103103
}
104104

105105
const char* levelFromEnv = getenv("NATIVEJS_LOG_LEVEL");
106+
// checking for ethan log env
107+
#ifdef USE_ETHANLOG
108+
NativeJSLogger::isEthanLogEnabled();
109+
NativeJSLogger::log(INFO, "EthanLog is enabled");
110+
#endif
106111
if(levelFromEnv)
107112
{
108113
NativeJSLogger::setLogLevel(levelFromEnv);

0 commit comments

Comments
 (0)