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