ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
consolelogger.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//==================================================================================================
8ALIB_EXPORT namespace alib { namespace lox {
9//==================================================================================================
10/// This is the C++ namespace for the implementation of <em>logger classes</em> that are provided
11/// by default with <b>%ALox Logging Library</b>.
12///
13/// Developed by A-Worx GmbH and published under Boost Software License.
14//==================================================================================================
15namespace loggers {
16
17//==================================================================================================
18/// A logger that logs all messages to the standard output <em>cout</em>.
19/// The name of the \e Logger defaults to "CONSOLE".
20///
21/// \alox text logger escape sequences (see class \ref alib::lox::ESC "ESC")
22/// are removed and ignored.
23//==================================================================================================
25{
26 protected:
27 /// The encapsulated output stream.
29
30 // #############################################################################################
31 // Constructor/destructor
32 // #############################################################################################
33 public:
34 //==========================================================================================
35 /// Creates a ConsoleLogger.
36 /// @param name (Optional) The name of the \e Logger, defaults to "CONSOLE".
37 //==========================================================================================
38 explicit ConsoleLogger( const NString& name= nullptr )
39 : PlainTextLogger( name, "CONSOLE", true )
40 {}
41
42
43 //==========================================================================================
44 /// Destructs a ConsoleLogger
45 //==========================================================================================
46 virtual ~ConsoleLogger() override {}
47
48 // #############################################################################################
49 // Abstract method implementations
50 // #############################################################################################
51 protected:
52 //==========================================================================================
53 /// Starts/ends log line. Appends a new-line character sequence to previously logged lines.
54 ///
55 /// @param phase Indicates the beginning or end of a log line.
56 /// @return Always returns true.
57 //==========================================================================================
59 virtual bool notifyLogOp( lang::Phase phase ) override;
60
61 //==========================================================================================
62 /// Writes the given region of the given string to the console.
63 ///
64 /// @param buffer The string to write a portion of.
65 /// @param start The start of the portion in \p{buffer} to write out.
66 /// @param length The length of the portion in \p{buffer} to write out.
67 /// @return The number of characters written, -1 on error.
68 //==========================================================================================
70 virtual integer logSubstring( const String& buffer,
71 integer start, integer length ) override;
72
73
74 //==========================================================================================
75 /// Empty implementation, not needed for this class
76 //==========================================================================================
77 virtual void notifyMultiLineOp( lang::Phase ) override {}
78
79}; // class ConsoleLogger
80
81
82}} // namespace alib[::lox::loggers]
83
84/// Type alias in namespace \b alib.
86
87} // namespace [alib]
88
89
virtual ALIB_DLL integer logSubstring(const String &buffer, integer start, integer length) override
virtual ALIB_DLL bool notifyLogOp(lang::Phase phase) override
StringWriter writer
The encapsulated output stream.
virtual void notifyMultiLineOp(lang::Phase) override
Empty implementation, not needed for this class.
virtual ~ConsoleLogger() override
Destructs a ConsoleLogger.
ConsoleLogger(const NString &name=nullptr)
PlainTextLogger(const NString &name, const NString &typeName, bool pUsesStdStreams)
#define ALIB_DLL
Definition alib.inl:496
#define ALIB_EXPORT
Definition alib.inl:488
Phase
Denotes a phase, e.g.,of a transaction.
lox::loggers::ConsoleLogger ConsoleLogger
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::compatibility::std::StringWriter StringWriter
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
Definition string.inl:2381