Use a Logger to print initialization errors

This way the errors will get written to a file instead of to STDERR if
`YABRIDGE_DEBUG_FILE` is set.
This commit is contained in:
Robbert van der Helm
2020-05-09 11:15:27 +02:00
parent c76992bb66
commit 57cb404f6b
3 changed files with 12 additions and 9 deletions
+4 -2
View File
@@ -19,6 +19,7 @@
#include <iostream>
#include <memory>
#include "../common/logging.h"
#include "plugin-bridge.h"
#define VST_EXPORT __attribute__((visibility("default")))
@@ -55,8 +56,9 @@ VST_EXPORT AEffect* VSTPluginMain(audioMasterCallback host_callback) {
return &bridge->plugin;
} catch (const std::exception& error) {
std::cerr << "Error during initialization:" << std::endl;
std::cerr << error.what() << std::endl;
Logger logger = Logger::create_from_environment();
logger.log("Error during initialization:");
logger.log(error.what());
return nullptr;
}