ALib C++ Library
Library Version: 2412 R0
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#ifndef HPP_ALIB_LOX_VSTUDIO_LOGGER
9#define HPP_ALIB_LOX_VSTUDIO_LOGGER 1
10#pragma once
11#if defined(_MSC_VER) && ALIB_DEBUG
12
14
15
16namespace alib { namespace lox { namespace loggers {
17//==================================================================================================
18/// A logger that logs to the Visual Studio output pane using <em>OutputDebugString()</em>.
19/// The name of the \e Logger defaults to "VSTUDIO_CONSOLE".
20///
21/// \alox text logger escape sequences (see class \ref alib::lox::ESC "ESC")
22/// are removed and ignored.
23///
24/// \note For the ease of use, class
25/// \ref alib::lox::Log "Log" implements a method
26/// \ref alib::lox::Log::AddDebugLogger "Log::AddDebugLogger"
27/// that tries to create the right Logger type for standard debug logging.
28/// If a Visual Studio debug session is detected, this logger is added. If in addition, a windows
29/// console application is detected, then a second logger of type WindowsConsoleLogger is added.
30//==================================================================================================
32{
33 // #############################################################################################
34 // Internal members
35 // #############################################################################################
36 protected:
37 /// A character buffer used for the creation of zero-terminated output strings
38 /// required by the VStudio logger interface.
39 ///
40 /// If \ref ALIB_CHARACTERS_WIDE is set, this string also acts as a converter to wide
41 /// characters.
43
44 // #############################################################################################
45 // Constructor/destructor
46 // #############################################################################################
47 public:
48 //==========================================================================================
49 /// Creates a VStudioLogger.
50 /// @param name (Optional) The name of the \e Logger, defaults to "VSTUDIO_CONSOLE".
51 //==========================================================================================
53 explicit VStudioLogger( const NString& name= nullptr );
54
55 //==========================================================================================
56 /// Destructs a VStudioLogger
57 //==========================================================================================
59 virtual ~VStudioLogger();
60
61 // #############################################################################################
62 // Abstract method implementations
63 // #############################################################################################
64 protected:
65 /// Invokes parent method. Then performs some VStudio-related adoptions.
66 ///
67 /// @param lox The \b %Lox to acknowledge insertion or removal
68 /// @param op The operation. Either \b ContainerOp::Insert or \b ContainerOp::Remove.
70 virtual void AcknowledgeLox( detail::LoxImpl* lox, lang::ContainerOp op ) override;
71
72 //==========================================================================================
73 /// Start a new log line. Appends a new-line character sequence to previously logged lines.
74 ///
75 /// @param phase Indicates the beginning or end of a log operation.
76 /// @return Always returns true.
77 //==========================================================================================
79 virtual bool notifyLogOp(lang::Phase phase);
80
81 //==========================================================================================
82 /// Write the given region of the given AString to the destination buffer.
83 ///
84 /// @param buffer The string to write a portion of.
85 /// @param start The start of the portion in \p{buffer} to write out.
86 /// @param length The length of the portion in \p{buffer} to write out.
87 /// @return The number of characters written, -1 on error.
88 //==========================================================================================
90 virtual integer logSubstring( const String& buffer, integer start, integer length );
91
92
93 //==========================================================================================
94 /// Empty implementation, not needed for this class
95 //==========================================================================================
97 virtual void notifyMultiLineOp (lang::Phase ) { }
98
99
100}; // class VStudioLogger
101
102
103}} // namespace alib[::lox::loggers]
104
105/// Type alias in namespace \b alib.
107
108} // namespace [alib]
109
110
111#endif // defined(_MSC_VER) && ALIB_DEBUG
112
113#endif // HPP_ALIB_LOX_VSTUDIO_LOGGER
114
virtual ALIB_API void notifyMultiLineOp(lang::Phase)
Empty implementation, not needed for this class.
virtual ALIB_API ~VStudioLogger()
Destructs a VStudioLogger.
virtual ALIB_API bool notifyLogOp(lang::Phase phase)
virtual ALIB_API void AcknowledgeLox(detail::LoxImpl *lox, lang::ContainerOp op) override
virtual ALIB_API integer logSubstring(const String &buffer, integer start, integer length)
#define ALIB_API
Definition alib.hpp:639
Phase
Denotes a phase, e.g.,of a transaction.
ContainerOp
Denotes standard container operations.
Definition alib.cpp:69
lox::loggers::VStudioLogger VStudioLogger
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
Definition integers.hpp:273