[TIMOB-23241] Windows: logging from native module doesn't work
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-04-26T13:52:28.000+0000 |
Affected Version/s | Release 5.3.0 |
Fix Version/s | Release 5.4.0, Release 5.3.0 |
Components | Windows |
Labels | n/a |
Reporter | Kota Iguchi |
Assignee | Kota Iguchi |
Created | 2016-04-19T22:51:10.000+0000 |
Updated | 2016-06-30T11:34:52.000+0000 |
Description
The C++ macros for logging (
TITANIUM_LOG_DEBUG
etc) shows nothing when you launch the app from Titanium CLI. That's because TITANIUM_LOG_DEBUG
prints out to standard out but Titanium CLI uses different protocol (log relay: listening sockets and relays it to CLI).
I guess the easiest workaround would be to create C++ macro that just calls
get_context().JSEvaluateScript("Ti.API.info(" + message + ");")
.Do we want different macros for logging to VS console versus to Ti.API logger? I'm concerned that just switching over to using Ti.API will mean lots of logging flowing to the CLI for our internal SDK - that we likely don't want to show whatsoever. I think there's a difference between what we want to log internally for development of the SDK versus logging to the console for module development purposes.
Makes sense. I think we need logging for module development, maybe something like
TITANIUM_MODULE_LOG_DEBUG
and so on.https://github.com/appcelerator/titanium_mobile_windows/pull/642
Pushed to master, will be available in nightly build soon. // new include is required, to use new logging macros #include "TitaniumWindows/LogForwarder.hpp" // Logging macro for native module debugging: -TITANIUM_MODULE_LOG_TRACE("value: " << value);- // In the background service, you need to use this: -TITANIUM_MODULE_LOG_INFO_BACKGROUND("value: " << value);- Note that you will need to re-create module project in order to use new logging macros. It is required because we need to set new include path and library path... For more information on Windows native module development, see [Windows_Module_Development_Guide](http://docs.appcelerator.com/platform/latest/#!/guide/Windows_Module_Development_Guide).
TIMOB-23274 introduces macro argument spec changes to align with
TITANIUM_LOG_INFO
. Now it uses,
to receive multiple parameters.{quote} I believe testing this ticket as part of 5.3.0 will be blocked by bugs in 5_3_X that are fixed in master {quote} [~eharris] Do you mean you know specific ticket number for the "bugs in 5_3_X that are fixed in master"? I guess TIMOB-23246 ?
[~eharris] Yeah,
appc
has a issue building Windows module ( as I recall even on 5.4.X). For a workaround we useti build -p windows -T ws-local
for now. For more details please see [Windows Module Quick Start](http://docs.appcelerator.com/platform/latest/#!/guide/Windows_Module_Quick_Start).Just noticed that the issue on building module using
appc ti build
has been fixed (TIMOB-23157) for 5_4_X. I'm not quite sure which PR makes this work though, I'll check this again and see if we can make it on 5_3_X.I was trying to see if we can make
appc ti build
work with modules on 5_3_X (TIMOB-23157), and ends up finding we'll need a lot of changes to backport, such as TIMOB-23248 and TIMOB-23158 like Ewan pointed out, as well as changes in windowslib. I think it's too much for this limited time period for 5_3_X.Verified using: Windows 10 Pro Ti SDK: 5.4.0.v20160629063537 Appc NPM: 4.2.7-2 Appc CLI: 5.4.0-23 Appc Studio: 4.7.0.201606220541 Lumia 930: 10.0 Lumia 520: 8.1 Logging can now be performed using the functions below depending on the log level desired.
Closing ticket.