Commit e30847e6 authored by Nicolas Jager's avatar Nicolas Jager

internal : save debug output to file

Change-Id: Id637ece76a98ad4ad8a45944b1c356cc57f263c9
Tuleap: #1224
parent 6ddd60a2
...@@ -24,6 +24,7 @@ using namespace RingClientUWP; ...@@ -24,6 +24,7 @@ using namespace RingClientUWP;
using namespace Platform; using namespace Platform;
using namespace Windows::UI::Core; using namespace Windows::UI::Core;
using namespace Windows::Storage;
void void
RingDebug::print(const std::string& message, RingDebug::print(const std::string& message,
...@@ -53,5 +54,21 @@ RingDebug::print(const std::string& message, ...@@ -53,5 +54,21 @@ RingDebug::print(const std::string& message,
OutputDebugString((wString + L"\n").c_str()); OutputDebugString((wString + L"\n").c_str());
/* fire the event. */ /* fire the event. */
messageToScreen(ref new String(wString.c_str(), wString.length())); auto line = ref new String(wString.c_str(), wString.length());
} messageToScreen(line);
\ No newline at end of file FileIO::AppendTextAsync(_logFile, line+"\n");
}
RingClientUWP::RingDebug::RingDebug()
{
StorageFolder^ storageFolder = ApplicationData::Current->LocalFolder;
StorageFile^ logFile;
task<StorageFile^>(storageFolder->CreateFileAsync("debug.log", CreationCollisionOption::ReplaceExisting)).then([this](StorageFile^ file)
{
this->_logFile = file;
});
}
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
**************************************************************************/ **************************************************************************/
#pragma once #pragma once
using namespace Windows::Storage;
namespace RingClientUWP namespace RingClientUWP
{ {
...@@ -40,6 +42,8 @@ public: ...@@ -40,6 +42,8 @@ public:
} }
} }
property StorageFile^ _logFile;
/* properties */ /* properties */
/* functions */ /* functions */
...@@ -51,7 +55,7 @@ internal: ...@@ -51,7 +55,7 @@ internal:
event debugMessageToScreen^ messageToScreen; event debugMessageToScreen^ messageToScreen;
private: private:
RingDebug() {}; // singleton RingDebug(); // singleton
}; };
void WriteLine(String^ str) void WriteLine(String^ str)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment