impr: Disable console color output in web version
This commit is contained in:
parent
dfeb9dbc84
commit
baaf84298c
@ -15,6 +15,7 @@
|
||||
namespace hex::log::impl {
|
||||
|
||||
static wolv::io::File s_loggerFile;
|
||||
static bool s_colorOutputEnabled = false;
|
||||
std::mutex g_loggerMutex;
|
||||
|
||||
FILE *getDestination() {
|
||||
@ -40,11 +41,16 @@ namespace hex::log::impl {
|
||||
s_loggerFile = wolv::io::File(path / hex::format("{0:%Y%m%d_%H%M%S}.log", fmt::localtime(std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()))), wolv::io::File::Mode::Create);
|
||||
s_loggerFile.disableBuffering();
|
||||
|
||||
if (s_loggerFile.isValid()) break;
|
||||
if (s_loggerFile.isValid()) {
|
||||
s_colorOutputEnabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void enableColorPrinting() {
|
||||
s_colorOutputEnabled = true;
|
||||
|
||||
#if defined(OS_WINDOWS)
|
||||
auto hConsole = ::GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
if (hConsole != INVALID_HANDLE_VALUE) {
|
||||
@ -73,10 +79,10 @@ namespace hex::log::impl {
|
||||
|
||||
fmt::print(dest, "[{0:%H:%M:%S}] ", now);
|
||||
|
||||
if (isRedirected())
|
||||
fmt::print(dest, "{0} ", level);
|
||||
else
|
||||
if (s_colorOutputEnabled)
|
||||
fmt::print(dest, ts, "{0} ", level);
|
||||
else
|
||||
fmt::print(dest, "{0} ", level);
|
||||
|
||||
std::string projectThreadTag = projectName;
|
||||
if (auto threadName = TaskManager::getCurrentThreadName(); !threadName.empty())
|
||||
|
@ -48,6 +48,8 @@ namespace hex {
|
||||
}
|
||||
|
||||
void Window::initNative() {
|
||||
log::impl::enableColorPrinting();
|
||||
|
||||
// Add plugin library folders to dll search path
|
||||
for (const auto &path : hex::fs::getDefaultPaths(fs::ImHexPath::Libraries)) {
|
||||
if (std::fs::exists(path))
|
||||
|
@ -21,6 +21,8 @@ namespace hex {
|
||||
}
|
||||
|
||||
void Window::initNative() {
|
||||
log::impl::enableColorPrinting();
|
||||
|
||||
// Add plugin library folders to dll search path
|
||||
for (const auto &path : hex::fs::getDefaultPaths(fs::ImHexPath::Libraries)) {
|
||||
if (std::fs::exists(path))
|
||||
|
Loading…
Reference in New Issue
Block a user