diff options
| author | Tobin Ehlis <tobin@lunarg.com> | 2015-09-15 09:55:54 -0600 |
|---|---|---|
| committer | Tobin Ehlis <tobin@lunarg.com> | 2015-09-16 08:10:21 -0600 |
| commit | 14ae26d06b54f19f5367755ef4db0f86c03482a4 (patch) | |
| tree | d114cf1b612e595322e40addd4fffd9742c1e2a5 /layers/vk_layer_config.cpp | |
| parent | 967ce521d87b3e9a90114119dc816c4eb55f5a43 (diff) | |
| download | usermoji-14ae26d06b54f19f5367755ef4db0f86c03482a4.tar.xz | |
layers: Fix layer STDOUT logging
Diffstat (limited to 'layers/vk_layer_config.cpp')
| -rw-r--r-- | layers/vk_layer_config.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/layers/vk_layer_config.cpp b/layers/vk_layer_config.cpp index a9cf5d75..d5ee78b2 100644 --- a/layers/vk_layer_config.cpp +++ b/layers/vk_layer_config.cpp @@ -27,6 +27,7 @@ #include <map> #include <string.h> #include <vk_layer.h> +#include <iostream> #include "vk_loader_platform.h" #include "vk_layer_config.h" // The following is #included again to catch certain OS-specific functions @@ -97,6 +98,23 @@ const char *getLayerOption(const char *_option) return g_configFileObj.getOption(_option); } +// If option is NULL or stdout, return stdout, otherwise try to open option +// as a filename. If successful, return file handle, otherwise stdout +FILE* getLayerLogOutput(const char *_option, const char *layerName) +{ + FILE* log_output = NULL; + if (!_option || !strcmp("stdout", _option)) + log_output = stdout; + else { + log_output = fopen(_option, "w"); + if (log_output == NULL) { + if (_option) + std::cout << std::endl << layerName << " ERROR: Bad output filename specified: " << _option << ". Writing to STDOUT instead" << std::endl << std::endl; + log_output = stdout; + } + } +} + uint32_t getLayerOptionFlags(const char *_option, uint32_t optionDefault) { uint32_t flags = optionDefault; |
