Update to spice2x-26-02-17 (pre-apply)
> broken commit
This commit is contained in:
+17
-8
@@ -42,13 +42,12 @@ struct fmt_log {
|
||||
|
||||
template<>
|
||||
struct fmt::formatter<fmt_log> {
|
||||
template<typename ParseContext>
|
||||
constexpr auto parse(ParseContext &ctx) {
|
||||
constexpr auto parse(format_parse_context &ctx) {
|
||||
return ctx.begin();
|
||||
}
|
||||
|
||||
template<typename FormatContext>
|
||||
auto format(const fmt_log &v, FormatContext &ctx) {
|
||||
auto format(const fmt_log &v, FormatContext &ctx) const {
|
||||
return format_to(ctx.out(), FMT_COMPILE("{} {}:{}: "), log_get_datetime(v.ts), v.level, v.module);
|
||||
}
|
||||
};
|
||||
@@ -60,31 +59,41 @@ struct fmt_hresult {
|
||||
|
||||
template<>
|
||||
struct fmt::formatter<fmt_hresult> {
|
||||
template<typename ParseContext>
|
||||
constexpr auto parse(ParseContext &ctx) {
|
||||
constexpr auto parse(format_parse_context &ctx) {
|
||||
return ctx.begin();
|
||||
}
|
||||
|
||||
template<typename FormatContext>
|
||||
auto format(const fmt_hresult &v, FormatContext &ctx) {
|
||||
auto format(const fmt_hresult &v, FormatContext &ctx) const {
|
||||
return format_to(ctx.out(), FMT_COMPILE("0x{:08x}"), static_cast<unsigned>(v.result));
|
||||
}
|
||||
};
|
||||
|
||||
void show_popup_for_crash();
|
||||
void show_popup_for_fatal_error(std::string message);
|
||||
|
||||
// misc log
|
||||
#define LOG_FORMAT(level, module, fmt_str, ...) fmt::format(FMT_COMPILE("{}" fmt_str "\n"), \
|
||||
fmt_log { std::time(nullptr), level, module }, ## __VA_ARGS__)
|
||||
|
||||
#define LOG_FORMAT_POPUP(module, fmt_str, ...) fmt::format(FMT_COMPILE("{}: " fmt_str "\n"), module, ## __VA_ARGS__)
|
||||
|
||||
#define log_misc(module, format_str, ...) logger::push( \
|
||||
LOG_FORMAT("M", module, format_str, ## __VA_ARGS__), logger::Style::GREY)
|
||||
|
||||
#define log_info(module, format_str, ...) logger::push( \
|
||||
LOG_FORMAT("I", module, format_str, ## __VA_ARGS__), logger::Style::DEFAULT)
|
||||
|
||||
#define log_warning(module, format_str, ...) logger::push( \
|
||||
LOG_FORMAT("W", module, format_str, ## __VA_ARGS__), logger::Style::YELLOW)
|
||||
|
||||
#define log_special(module, format_str, ...) logger::push( \
|
||||
LOG_FORMAT("W", module, format_str, ## __VA_ARGS__), logger::Style::SPECIAL)
|
||||
|
||||
#define log_fatal(module, format_str, ...) { \
|
||||
logger::push(LOG_FORMAT("F", module, format_str, ## __VA_ARGS__), logger::Style::RED); \
|
||||
logger::push(LOG_FORMAT("F", "spice", "encountered a fatal error, you can close the window or press ctrl + c"), logger::Style::RED); \
|
||||
show_popup_for_fatal_error(LOG_FORMAT_POPUP(module, format_str, ## __VA_ARGS__)); \
|
||||
launcher::stop_subsystems(); \
|
||||
Sleep(10000); \
|
||||
launcher::kill(); \
|
||||
std::terminate(); \
|
||||
} ((void) 0 )
|
||||
|
||||
Reference in New Issue
Block a user