ALib C++ Library
by
Library Version:
2510 R0
Documentation generated by
Loading...
Searching...
No Matches
home
dev
A-Worx
ALib
src
alib
alox
loggers
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
//==================================================================================================
8
ALIB_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
//==================================================================================================
15
namespace
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
//==================================================================================================
24
class
ConsoleLogger
:
public
textlogger::PlainTextLogger
25
{
26
protected
:
27
/// The encapsulated output stream.
28
StringWriter
writer
;
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
//==========================================================================================
58
ALIB_DLL
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
//==========================================================================================
69
ALIB_DLL
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.
85
using
ConsoleLogger
=
lox::loggers::ConsoleLogger
;
86
87
}
// namespace [alib]
88
89
alib::lox::loggers::ConsoleLogger
Definition
consolelogger.inl:25
alib::lox::loggers::ConsoleLogger::logSubstring
virtual ALIB_DLL integer logSubstring(const String &buffer, integer start, integer length) override
Definition
consolelogger.cpp:38
alib::lox::loggers::ConsoleLogger::notifyLogOp
virtual ALIB_DLL bool notifyLogOp(lang::Phase phase) override
Definition
consolelogger.cpp:31
alib::lox::loggers::ConsoleLogger::writer
StringWriter writer
The encapsulated output stream.
Definition
consolelogger.inl:28
alib::lox::loggers::ConsoleLogger::notifyMultiLineOp
virtual void notifyMultiLineOp(lang::Phase) override
Empty implementation, not needed for this class.
Definition
consolelogger.inl:77
alib::lox::loggers::ConsoleLogger::~ConsoleLogger
virtual ~ConsoleLogger() override
Destructs a ConsoleLogger.
Definition
consolelogger.inl:46
alib::lox::loggers::ConsoleLogger::ConsoleLogger
ConsoleLogger(const NString &name=nullptr)
Definition
consolelogger.inl:38
alib::lox::textlogger::PlainTextLogger
Definition
plaintextlogger.inl:16
alib::lox::textlogger::PlainTextLogger::PlainTextLogger
PlainTextLogger(const NString &name, const NString &typeName, bool pUsesStdStreams)
Definition
plaintextlogger.inl:40
ALIB_DLL
#define ALIB_DLL
Definition
alib.inl:496
ALIB_EXPORT
#define ALIB_EXPORT
Definition
alib.inl:488
alib::lang::Phase
Phase
Denotes a phase, e.g.,of a transaction.
Definition
commonenumdefs.inl:127
alib::lox::loggers
Definition
ansilogger.cpp:36
alib::lox
Definition
alox.cpp:62
alib
Definition
ALib.Boxing.StdFunctors.H:18
alib::ConsoleLogger
lox::loggers::ConsoleLogger ConsoleLogger
Type alias in namespace alib.
Definition
consolelogger.inl:85
alib::integer
lang::integer integer
Type alias in namespace alib.
Definition
integers.inl:149
alib::NString
strings::TString< nchar > NString
Type alias in namespace alib.
Definition
string.inl:2390
alib::StringWriter
strings::compatibility::std::StringWriter StringWriter
Type alias in namespace alib.
Definition
stdiostream.mpp:365
alib::String
strings::TString< character > String
Type alias in namespace alib.
Definition
string.inl:2381