mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-11 16:46:16 +00:00
Support silencing logging in analyzer
This commit is contained in:
@@ -12,6 +12,7 @@ namespace
|
||||
bool use_gdb{false};
|
||||
bool concise_logging{false};
|
||||
bool verbose_logging{false};
|
||||
bool silent{false};
|
||||
std::string registry_path{"./registry"};
|
||||
std::string emulation_root{};
|
||||
};
|
||||
@@ -113,6 +114,7 @@ namespace
|
||||
.emulation_root = options.emulation_root,
|
||||
.arguments = parse_arguments(args),
|
||||
.verbose_calls = options.verbose_logging,
|
||||
.disable_logging = options.silent,
|
||||
.silent_until_main = options.concise_logging,
|
||||
};
|
||||
|
||||
@@ -122,6 +124,14 @@ namespace
|
||||
watch_system_objects(win_emu, options.concise_logging);
|
||||
win_emu.buffer_stdout = true;
|
||||
|
||||
if (options.silent)
|
||||
{
|
||||
win_emu.buffer_stdout = false;
|
||||
win_emu.callbacks().stdout_callback = [](const std::string_view data) {
|
||||
(void)fwrite(data.data(), 1, data.size(), stdout);
|
||||
};
|
||||
}
|
||||
|
||||
const auto& exe = *win_emu.process().executable;
|
||||
|
||||
const auto concise_logging = options.concise_logging;
|
||||
@@ -204,6 +214,10 @@ namespace
|
||||
{
|
||||
options.use_gdb = true;
|
||||
}
|
||||
else if (arg == "-s")
|
||||
{
|
||||
options.silent = true;
|
||||
}
|
||||
else if (arg == "-v")
|
||||
{
|
||||
options.verbose_logging = true;
|
||||
|
||||
@@ -33,6 +33,13 @@ namespace utils
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
requires(!std::is_same_v<std::remove_cvref_t<T>, std::function<Ret(Args...)>>)
|
||||
optional_function& operator=(T&& t)
|
||||
{
|
||||
return this->operator=(std::function<Ret(Args...)>(std::forward<T>(t)));
|
||||
}
|
||||
|
||||
Ret operator()(Args... args) const
|
||||
{
|
||||
if (func)
|
||||
|
||||
Reference in New Issue
Block a user