-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add logger, improve support for ARM64 & Windows 7 (#13)
* Add logger, improve support for ARM64 * Log errors * cleanup * review feedback * Add Architecture files..
- Loading branch information
Showing
12 changed files
with
319 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include "Architecture.h" | ||
|
||
std::wstring Architecture::AsString(const Value& arch) | ||
{ | ||
switch (arch) { | ||
case X64: | ||
return L"x64"; | ||
case ARM64: | ||
return L"arm64"; | ||
case X86: | ||
return L"x86"; | ||
case UNKNOWN: | ||
default: | ||
return L"unknown"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
namespace Architecture | ||
{ | ||
// Ordered to ensure that we only check for JVMs that will run on the host arch. | ||
// On an x64 host only check for x64 and x86 as arm will never run. | ||
// On x86 there is no need to try any other arch as it wont run. | ||
enum Value { | ||
UNKNOWN, | ||
ARM64, | ||
X64, | ||
X86, | ||
}; | ||
|
||
constexpr Value VALUES[] = { UNKNOWN, ARM64, X64, X86 }; | ||
|
||
std::wstring AsString(const Value& arch); | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "Logger.h" | ||
#include <sstream> | ||
|
||
namespace { | ||
std::wofstream openLogFile(ISystemHelper& systemHelper) { | ||
std::wstringstream fileNameBuf; | ||
fileNameBuf << systemHelper.getTempDir() << L"/fabric-installer-" << systemHelper.getEpochTime() << L".log"; | ||
return std::wofstream(fileNameBuf.str()); | ||
} | ||
} | ||
|
||
Logger::Logger(ISystemHelper& systemHelper) : file_(openLogFile(systemHelper)) | ||
{ | ||
} | ||
|
||
Logger::~Logger() | ||
{ | ||
file_.close(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
|
||
#include "ISystemHelper.h" | ||
#include <fstream> | ||
|
||
class Logger | ||
{ | ||
public: | ||
Logger(ISystemHelper& systemHelper); | ||
~Logger(); | ||
|
||
template<class T> | ||
void log(const T& line) { | ||
file_ << line << std::endl; | ||
} | ||
|
||
private: | ||
std::wofstream file_; | ||
}; |
Oops, something went wrong.