layers: If layers receive bad filename for output log, report ERROR and fallback to stdout
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp
index 6caced6..02f2e10 100644
--- a/layers/draw_state.cpp
+++ b/layers/draw_state.cpp
@@ -1308,8 +1308,11 @@
{
log_output = fopen(option_str, "w");
}
- if (log_output == NULL)
+ if (log_output == NULL) {
+ if (option_str)
+ cout << endl << "DrawState ERROR: Bad output filename specified: " << option_str << ". Writing to STDOUT instead" << endl << endl;
log_output = stdout;
+ }
layer_create_msg_callback(my_data->report_data, report_flags, log_callback, (void *) log_output, &my_data->logging_callback);
}
diff --git a/layers/mem_tracker.cpp b/layers/mem_tracker.cpp
index 3517b10..2b82c66 100644
--- a/layers/mem_tracker.cpp
+++ b/layers/mem_tracker.cpp
@@ -1308,6 +1308,8 @@
log_output = fopen(option_str, "w");
}
if (log_output == NULL) {
+ if (option_str)
+ cout << endl << "MemTracker ERROR: Bad output filename specified: " << option_str << ". Writing to STDOUT instead" << endl << endl;
log_output = stdout;
}
diff --git a/layers/param_checker.cpp b/layers/param_checker.cpp
index 9965c15..3d3ad0c 100644
--- a/layers/param_checker.cpp
+++ b/layers/param_checker.cpp
@@ -93,8 +93,9 @@
{
log_output = fopen(option_str, "w");
}
- if(log_output == NULL)
- {
+ if (log_output == NULL) {
+ if (option_str)
+ std::cout << std::endl << "ParamChecker ERROR: Bad output filename specified: " << option_str << ". Writing to STDOUT instead" << std::endl << std::endl;
log_output = stdout;
}
diff --git a/layers/shader_checker.cpp b/layers/shader_checker.cpp
index bb41906..35dd415 100644
--- a/layers/shader_checker.cpp
+++ b/layers/shader_checker.cpp
@@ -29,6 +29,7 @@
#include <map>
#include <vector>
#include <string>
+#include <iostream>
#include "vk_loader_platform.h"
#include "vk_dispatch_table_helper.h"
#include "vk_layer.h"
@@ -218,8 +219,11 @@
{
log_output = fopen(option_str, "w");
}
- if (log_output == NULL)
+ if (log_output == NULL) {
+ if (option_str)
+ std::cout << std::endl << "ShaderChecker ERROR: Bad output filename specified: " << option_str << ". Writing to STDOUT instead" << std::endl << std::endl;
log_output = stdout;
+ }
layer_create_msg_callback(my_data->report_data, report_flags, log_callback, (void *) log_output, &my_data->logging_callback);
}