Overriding platform specific logging feature

25 views
Skip to first unread message

Darin Dimitrov

unread,
Oct 9, 2019, 8:17:13 AM10/9/19
to v8-users
I am embedding V8 in an iOS application and I would like to override the "OS::Print" method: https://chromium.googlesource.com/v8/v8.git/+/3.7.12.26/src/platform-posix.cc#217

This method already handles the Android case by redirecting the output to logcat:

void OS::VPrint(const char* format, va_list args) {
#if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT)
  __android_log_vprint(ANDROID_LOG_INFO, LOG_TAG, format, args);
#else
  vprintf(format, args);
#endif
}

What would be the best way to override this method for my platform without modifying the V8 source code (I have compiled V8 as a static library that I am linking against in my iOS application)?

Jakob Gruber

unread,
Oct 9, 2019, 8:40:58 AM10/9/19
to v8-u...@googlegroups.com
Is the override specific to iOS or to a particular application? If the former, why not upstream it in V8?

--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-users/acfff90d-6acd-47fa-984b-ebe2def46853%40googlegroups.com.

Darin Dimitrov

unread,
Oct 9, 2019, 8:57:13 AM10/9/19
to v8-users
In my case, the output is specific to a particular application as I need to include some additional environment information to the output.


On Wednesday, October 9, 2019 at 3:40:58 PM UTC+3, Jakob Gruber wrote:
Is the override specific to iOS or to a particular application? If the former, why not upstream it in V8?

On Wed, Oct 9, 2019 at 2:17 PM Darin Dimitrov <darin....@gmail.com> wrote:
I am embedding V8 in an iOS application and I would like to override the "OS::Print" method: https://chromium.googlesource.com/v8/v8.git/+/3.7.12.26/src/platform-posix.cc#217

This method already handles the Android case by redirecting the output to logcat:

void OS::VPrint(const char* format, va_list args) {
#if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT)
  __android_log_vprint(ANDROID_LOG_INFO, LOG_TAG, format, args);
#else
  vprintf(format, args);
#endif
}

What would be the best way to override this method for my platform without modifying the V8 source code (I have compiled V8 as a static library that I am linking against in my iOS application)?

--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages