I have created the WindowsPhone8 project using IBM MobilFirst Studio Version 7
. This is creating Window Phone Silverlight 8.1 project for VS (Visual Studio).
我使用IBM MobilFirst Studio Version 7创建了WindowsPhone8项目。这是为VS(Visual Studio)创建Window Phone Silverlight 8.1项目。
When I put console.log
in js file and test the application on device, that logs are not coming in Visual Studio's Output console.
当我将console.log放在js文件中并在设备上测试应用程序时,这些日志不会出现在Visual Studio的输出控制台中。
In output console, I have also filter the messages by Javascript. In debug section of project properties, it is not showing me Native with Script option.
在输出控制台中,我还通过Javascript过滤消息。在项目属性的调试部分,它没有向我显示Native with Script选项。
Is there any option I have to enable or some configuration I have to do in order to enable console.log
in VS?
为了在VS中启用console.log,我是否需要启用任何选项或进行一些配置?
Edit 1: I have tried WL.Logger.warn, WL.Logger.error and WL.Logger.info, but none of them works.
编辑1:我尝试过WL.Logger.warn,WL.Logger.error和WL.Logger.info,但它们都没有。
2 个解决方案
#1
0
This is a limitation of Silverlight-Visual Studio itself and not MFP. To debug a MFPF Silverlight application, you can follow the approaches mentioned in this article.
这是Silverlight-Visual Studio本身的限制,而不是MFP。要调试MFPF Silverlight应用程序,可以按照本文中提到的方法进行操作。
#2
0
What I have done is, I made Logger.cs (C#) file and place the following code to work it as plugin.
我所做的是,我制作了Logger.cs(C#)文件,并将以下代码作为插件使用。
namespace Cordova.Extension.Commands
{
class Logger : BaseCommand
{
public void log(String options) {
//System.Diagnostics.Debug.WriteLine("Logging From Plugin");
string optVal = null;
try {
optVal = JsonHelper.Deserialize<string[]>(options)[0];
System.Diagnostics.Debug.WriteLine(optVal);
DispatchCommandResult(new PluginResult(PluginResult.Status.OK, "Logger Logged"));
}
catch (Exception)
{
DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Logger signaled an error"));
}
}
}
}
In my js file, I have overrided console.log, WL.Logger.warn, WL.Logger.info and other loggers as follows.
在我的js文件中,我已经覆盖了console.log,WL.Logger.warn,WL.Logger.info和其他记录器,如下所示。
console.log = function (message) {
cordova.exec("", "", "Logger", "log", ["Log : " + message]);
}
WL.Logger.warn = function ( message ) {
cordova.exec("", "", "Logger", "log", ["Warning : " + message]);
}
WL.Logger.error = function (message) {
cordova.exec("", "", "Logger", "log", ["Error : " + message]);
}
WL.Logger.debug = function (message) {
cordova.exec("", "", "Logger", "log", ["Debug : " + message]);
}
WL.Logger.info = function (message) {
cordova.exec("", "", "Logger", "log", ["Info : " + message]);
}
In config.xml file, I have registered my plugin and now each and every Log is shown in VS Output Console, no requirement of Vorlon.js
在config.xml文件中,我已经注册了我的插件,现在每个日志都显示在VS Output Console中,不需要Vorlon.js
<feature name="Logger">
<param name="wp-package" value="Logger" />
</feature>
#1
0
This is a limitation of Silverlight-Visual Studio itself and not MFP. To debug a MFPF Silverlight application, you can follow the approaches mentioned in this article.
这是Silverlight-Visual Studio本身的限制,而不是MFP。要调试MFPF Silverlight应用程序,可以按照本文中提到的方法进行操作。
#2
0
What I have done is, I made Logger.cs (C#) file and place the following code to work it as plugin.
我所做的是,我制作了Logger.cs(C#)文件,并将以下代码作为插件使用。
namespace Cordova.Extension.Commands
{
class Logger : BaseCommand
{
public void log(String options) {
//System.Diagnostics.Debug.WriteLine("Logging From Plugin");
string optVal = null;
try {
optVal = JsonHelper.Deserialize<string[]>(options)[0];
System.Diagnostics.Debug.WriteLine(optVal);
DispatchCommandResult(new PluginResult(PluginResult.Status.OK, "Logger Logged"));
}
catch (Exception)
{
DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Logger signaled an error"));
}
}
}
}
In my js file, I have overrided console.log, WL.Logger.warn, WL.Logger.info and other loggers as follows.
在我的js文件中,我已经覆盖了console.log,WL.Logger.warn,WL.Logger.info和其他记录器,如下所示。
console.log = function (message) {
cordova.exec("", "", "Logger", "log", ["Log : " + message]);
}
WL.Logger.warn = function ( message ) {
cordova.exec("", "", "Logger", "log", ["Warning : " + message]);
}
WL.Logger.error = function (message) {
cordova.exec("", "", "Logger", "log", ["Error : " + message]);
}
WL.Logger.debug = function (message) {
cordova.exec("", "", "Logger", "log", ["Debug : " + message]);
}
WL.Logger.info = function (message) {
cordova.exec("", "", "Logger", "log", ["Info : " + message]);
}
In config.xml file, I have registered my plugin and now each and every Log is shown in VS Output Console, no requirement of Vorlon.js
在config.xml文件中,我已经注册了我的插件,现在每个日志都显示在VS Output Console中,不需要Vorlon.js
<feature name="Logger">
<param name="wp-package" value="Logger" />
</feature>