有没有办法在 WinJS 中将 Windows.Foundation.Diagnostics.LoggingSession 保存为文本?

Is there a way to save a Windows.Foundation.Diagnostics.LoggingSession as text in WinJS?

我正在执行以下操作以使用 LogginSession 保存日志文件并将它们写入文件:

loggingChannel = new Windows.Foundation.Diagnostics.LoggingChannel("FlSMobileLogger");
LoggingSession = new Windows.Foundation.Diagnostics.LoggingSession("FLSMobileLog");
LoggingSession.addLoggingChannel(loggingChannel);

....

function enteredWhenLogEventOccurs(message) {

            var dateString = new Date().toJSON();
            var currentDate = dateString.substring(0, 4) + "-" + dateString.substring(5, 7) + "-" + dateString.substring(8, 10);
            var fileName = "log" + currentDate + ".log";

            loggingChannel.logMessage(message);
            LoggingSession.saveToFileAsync(WinJS.Application.local.folder, fileName);                     
        }

这些日志会话保存为二进制 .etl 文件。 有没有办法将它们保存为文本或以任何方式转换它们?

提前致谢!

这个命令可以将ETL文件转换成XML:

tracerpt.exe LogFile.etl -of XML -o LogFile.xml

您可以在此处找到完整示例:

https://msdn.microsoft.com/en-us/library/windows/apps/windows.foundation.diagnostics.fileloggingsession