DocWire SDK
DocWire SDK: Award-winning modern data processing in C++20. SourceForge Community Choice & Microsoft support. AI-driven processing. Supports nearly 100 data formats, including email boxes and OCR. Boost efficiency in text extraction, web data extraction, data mining, document analysis. Offline processing possible for security and confidentiality
log_cerr_redirection.h
1 /*********************************************************************************************************************************************/
2 /* DocWire SDK: Award-winning modern data processing in C++20. SourceForge Community Choice & Microsoft support. AI-driven processing. */
3 /* Supports nearly 100 data formats, including email boxes and OCR. Boost efficiency in text extraction, web data extraction, data mining, */
4 /* document analysis. Offline processing possible for security and confidentiality */
5 /* */
6 /* Copyright (c) SILVERCODERS Ltd, http://silvercoders.com */
7 /* Project homepage: https://github.com/docwire/docwire */
8 /* */
9 /* SPDX-License-Identifier: GPL-2.0-only OR LicenseRef-DocWire-Commercial */
10 /*********************************************************************************************************************************************/
11 
12 #ifndef DOCWIRE_LOG_CERR_REDIRECTION_H
13 #define DOCWIRE_LOG_CERR_REDIRECTION_H
14 
15 #include "core_export.h"
16 #include "pimpl.h"
17 #include "source_location.h"
18 #include <string_view>
19 
20 namespace docwire::log
21 {
22 
24 struct DOCWIRE_CORE_EXPORT stderr_redirect { static constexpr std::string_view string() { return "stderr_redirect"; } };
25 
26 class DOCWIRE_CORE_EXPORT cerr_redirection : public with_pimpl<cerr_redirection>
27 {
28 public:
33  explicit cerr_redirection(const source_location& location = source_location::current());
34 
35  cerr_redirection(const cerr_redirection&) = delete;
36  cerr_redirection& operator=(const cerr_redirection&) = delete;
38  void redirect();
39  void restore();
40 };
41 
42 } // namespace docwire::log
43 
44 #endif // DOCWIRE_LOG_CERR_REDIRECTION_H
cerr_redirection(const source_location &location=source_location::current())
Constructs a cerr_redirection object, capturing the source location.
Provides a modern, high-performance, and structured logging framework.
A fallback implementation of source_location for compilers that do not support std::source_location.
Tag for log entries that contain content redirected from stderr.