ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
vstudiologger.hpp
Go to the documentation of this file.
1/** ************************************************************************************************
2 * \file
3 * This header file is part of module \alib_alox of the \aliblong.
4 *
5 * \emoji :copyright: 2013-2024 A-Worx GmbH, Germany.
6 * Published under \ref mainpage_license "Boost Software License".
7 **************************************************************************************************/
8
9#ifndef HPP_ALOX_VSTUDIO_LOGGER
10#define HPP_ALOX_VSTUDIO_LOGGER 1
11
12#if defined(_MSC_VER) && ALIB_DEBUG
13
14#if !defined (HPP_ALOX_DETAIL_TEXTLOGGER_PLAINTEXTLOGGER)
16#endif
17
18
19namespace alib { namespace lox { namespace loggers {
20/** ************************************************************************************************
21 * A logger that logs to the Visual Studio output pane using <em>OutputDebugString()</em>.
22 * The name of the \e Logger defaults to "VSTUDIO_CONSOLE".
23 *
24 * \alox text logger escape sequences (see class \ref alib::lox::ESC "ESC")
25 * are removed and ignored.
26 *
27 * \note For the ease of use, class
28 * \ref alib::lox::Log "Log" implements a method
29 * \ref alib::lox::Log::AddDebugLogger "Log::AddDebugLogger"
30 * that tries to create the right Logger type for standard debug logging.
31 * If a Visual Studio debug session is detected, this logger is added. If in addition, a windows
32 * console application is detected, then a second logger of type WindowsConsoleLogger is added.
33 **************************************************************************************************/
35{
36 // #############################################################################################
37 // Internal members
38 // #############################################################################################
39 protected:
40 /**
41 * A character buffer used for the creation of zero-terminated output strings
42 * required by the VStudio logger interface.
43 *
44 * If \ref ALIB_CHARACTERS_WIDE is set, this string also acts as a converter to wide
45 * characters.
46 */
48
49 // #############################################################################################
50 // Constructor/destructor
51 // #############################################################################################
52 public:
53 /** ****************************************************************************************
54 * Creates a VStudioLogger.
55 * @param name (Optional) The name of the \e Logger, defaults to "VSTUDIO_CONSOLE".
56 ******************************************************************************************/
58 explicit VStudioLogger( const NString& name= nullptr );
59
60 /** ****************************************************************************************
61 * Destructs a VStudioLogger
62 ******************************************************************************************/
64 virtual ~VStudioLogger();
65
66 // #############################################################################################
67 // Abstract method implementations
68 // #############################################################################################
69 protected:
70 /** ****************************************************************************************
71 * Start a new log line. Appends a new-line character sequence to previously logged lines.
72 *
73 * @param phase Indicates the beginning or end of a log operation.
74 * @return Always returns true.
75 ******************************************************************************************/
77 virtual bool notifyLogOp(lang::Phase phase);
78
79 /** ****************************************************************************************
80 * Write the given region of the given AString to the destination buffer.
81 *
82 * @param buffer The string to write a portion of.
83 * @param start The start of the portion in \p{buffer} to write out.
84 * @param length The length of the portion in \p{buffer} to write out.
85 * @return The number of characters written, -1 on error.
86 ******************************************************************************************/
88 virtual integer logSubstring( const String& buffer, integer start, integer length );
89
90
91 /** ****************************************************************************************
92 * Empty implementation, not needed for this class
93 ******************************************************************************************/
95 virtual void notifyMultiLineOp (lang::Phase ) { }
96
97
98}; // class VStudioLogger
99
100
101}} // namespace alib[::lox::loggers]
102
103/// Type alias in namespace \b alib.
105
106} // namespace [alib]
107
108
109#endif // defined(_MSC_VER) && ALIB_DEBUG
110
111#endif // HPP_ALOX_VSTUDIO_LOGGER
virtual ALIB_API void notifyMultiLineOp(lang::Phase)
virtual ALIB_API bool notifyLogOp(lang::Phase phase)
virtual ALIB_API integer logSubstring(const String &buffer, integer start, integer length)
#define ALIB_API
Definition alib.hpp:538
Definition alib.cpp:57
lox::loggers::VStudioLogger VStudioLogger
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
Definition integers.hpp:286