-
Notifications
You must be signed in to change notification settings - Fork 35
/
main.cpp
41 lines (32 loc) · 1.6 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "inexor/vulkan-renderer/application.hpp"
#include <spdlog/async.h>
#include <spdlog/sinks/basic_file_sink.h>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/spdlog.h>
#include <stdexcept>
int main(int argc, char *argv[]) {
spdlog::init_thread_pool(8192, 2);
auto console_sink = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();
auto file_sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>("vulkan-renderer.log", true);
auto vulkan_renderer_log =
std::make_shared<spdlog::async_logger>("vulkan-renderer", spdlog::sinks_init_list{console_sink, file_sink},
spdlog::thread_pool(), spdlog::async_overflow_policy::block);
vulkan_renderer_log->set_level(spdlog::level::trace);
vulkan_renderer_log->set_pattern("%Y-%m-%d %T.%f %^%l%$ %5t [%-10n] %v");
vulkan_renderer_log->flush_on(spdlog::level::debug); // TODO: as long as we don't have a flush on crash
spdlog::set_default_logger(vulkan_renderer_log);
spdlog::trace("Inexor vulkan-renderer, BUILD " + std::string(__DATE__) + ", " + __TIME__);
spdlog::trace("Parsing command line arguments");
std::unique_ptr<inexor::vulkan_renderer::Application> renderer;
try {
renderer = std::make_unique<inexor::vulkan_renderer::Application>(argc, argv);
} catch (const std::runtime_error &exception) {
spdlog::critical(exception.what());
return 1;
} catch (const std::exception &exception) {
spdlog::critical(exception.what());
return 1;
}
renderer->run();
spdlog::trace("Window closed");
}