diff --git a/console/executor_events.cpp b/console/executor_events.cpp index a5278973..96ab9cbb 100644 --- a/console/executor_events.cpp +++ b/console/executor_events.cpp @@ -61,8 +61,11 @@ const std::unordered_map executor::fired_ // Events. // ---------------------------------------------------------------------------- +// Eventing uses underling std::ostream. It is possible that these may throw +// upon certain unexpected failures, such as a disconnected device. Presently +// the writes are not wrapped in a try block (performance) but this can be +// appplied centrally below if desired. -// TODO: throws, handle failure. system::ofstream executor::create_event_sink() const { // Standard file name, within the [node].path directory. diff --git a/console/executor_logging.cpp b/console/executor_logging.cpp index 68d09446..b36d0552 100644 --- a/console/executor_logging.cpp +++ b/console/executor_logging.cpp @@ -42,11 +42,14 @@ const std::unordered_map executor::defined_ // Logging. // ---------------------------------------------------------------------------- +// Logging uses underling std::ostream. It is possible that these may throw +// upon certain unexpected failures, such as a disconnected device. Presently +// the writes are not wrapped in a try block (performance) but this can be +// appplied centrally below if desired. -// TODO: verify construction failure handled. database::file::stream::out::rotator executor::create_log_sink() const { - return + return { // Standard file names, within the [node].path directory. metadata_.configured.log.log_file1(), diff --git a/console/executor_runner.cpp b/console/executor_runner.cpp index d218792f..f9b25c64 100644 --- a/console/executor_runner.cpp +++ b/console/executor_runner.cpp @@ -36,7 +36,7 @@ void executor::stopper(const std::string& message) capture_.stop(); // Stop log, causing final message to be buffered by handler. - log_.stop(message,levels::application); + log_.stop(message, levels::application); // Suspend process termination until final message is buffered. stopped_.get_future().wait(); @@ -106,10 +106,13 @@ bool executor::do_run() auto events = create_event_sink(); if (!log || !events) { + // Stop ensures console output. + log_.stop(); logger(BS_LOG_INITIALIZE_FAILURE); return false; } + // These all use std iostreams (exception risk). subscribe_log(log); subscribe_events(events); subscribe_capture(); diff --git a/console/localize.hpp b/console/localize.hpp index 1836e115..cac237cc 100644 --- a/console/localize.hpp +++ b/console/localize.hpp @@ -263,7 +263,7 @@ "compiled:%1% enabled:%2%." #define BS_LOG_INITIALIZE_FAILURE \ - "Failed to initialize logging." + "Failed to initialize logging, check configured path." #define BS_USING_CONFIG_FILE \ "Using config file: %1%" #define BS_USING_DEFAULT_CONFIG \