nx_server_plugin_sdk 1.0 Server Plugin SDK

output_redirector.h
1 // Copyright 2018-present Network Optix, Inc. Licensed under MPL 2.0: www.mozilla.org/MPL/2.0/
2
3 #pragma once
4
5 #include <string>
6
7 #if !defined(NX_KIT_API)
8 #define NX_KIT_API
9 #endif
10
11 namespace nx {
12 namespace kit {
13
40 class NX_KIT_API OutputRedirector
41 {
42 public:
43 OutputRedirector(const OutputRedirector&) = delete;
44
45 void operator=(const OutputRedirector&) = delete;
46
47 static const OutputRedirector& getInstance();
48
49 bool isStdoutRedirected() const { return m_isStdoutRedirected; }
50 bool isStderrRedirected() const { return m_isStderrRedirected; }
51
68 static void ensureOutputRedirection();
69
70 protected: //< Intended for unit tests.
71 OutputRedirector(const char* overridingLogFilesDir = nullptr);
72
73 private:
74 bool m_isStdoutRedirected = false;
75 bool m_isStderrRedirected = false;
76 };
77
78 } // namespace kit
79 } // namespace nx
nx
Definition: apple_utils.h:6
nx::kit::OutputRedirector
Definition: output_redirector.h:40