From 3cddf5f992eb49599fd5d830bf4fb6f9bfd643fc Mon Sep 17 00:00:00 2001 From: evoskuil Date: Wed, 22 Apr 2026 22:42:27 -0400 Subject: [PATCH 1/2] Fix lack of console message when log path is bad. --- console/executor_runner.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/console/executor_runner.cpp b/console/executor_runner.cpp index d218792f..e4c10a3e 100644 --- a/console/executor_runner.cpp +++ b/console/executor_runner.cpp @@ -106,6 +106,8 @@ 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; } From b063516be226296ce30b3c1d850cd8cee02e6248 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Wed, 22 Apr 2026 22:42:46 -0400 Subject: [PATCH 2/2] Style, comments, text, whitespace. --- console/executor_events.cpp | 5 ++++- console/executor_logging.cpp | 7 +++++-- console/executor_runner.cpp | 3 ++- console/localize.hpp | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) 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 e4c10a3e..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(); @@ -112,6 +112,7 @@ bool executor::do_run() 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 \