9#if !defined(ALIB_C20_MODULES) || ((ALIB_C20_MODULES != 0) && (ALIB_C20_MODULES != 1))
10# error "Symbol ALIB_C20_MODULES has to be given to the compiler as either 0 or 1"
39using namespace detail;
44 #define W32C_FOREGROUND_MASK 0xFFF0
45 #define W32C_BACKGROUND_MASK 0xFF0F
48 #define W32C_RED FOREGROUND_RED
49 #define W32C_GREEN FOREGROUND_GREEN
50 #define W32C_BLUE FOREGROUND_BLUE
51 #define W32C_CYAN FOREGROUND_GREEN | FOREGROUND_BLUE
52 #define W32C_MAGENTA FOREGROUND_RED | FOREGROUND_BLUE
53 #define W32C_YELLOW FOREGROUND_RED | FOREGROUND_GREEN
54 #define W32C_WHITE FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY
56 #define W32C_GRAY_LIGHT FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE
57 #define W32C_GRAY_DARK FOREGROUND_INTENSITY
78 WORD actualAttributes;
80 HANDLE H= GetStdHandle(STD_OUTPUT_HANDLE);
81 CONSOLE_SCREEN_BUFFER_INFO info;
82 GetConsoleScreenBufferInfo( H, &info );
83 actualAttributes= info.wAttributes;
98 (void) useLightColors.
Define();
130 HANDLE H= GetStdHandle(STD_OUTPUT_HANDLE);
134 WORD actualAttributes;
136 CONSOLE_SCREEN_BUFFER_INFO info;
137 GetConsoleScreenBufferInfo( H, &info );
138 actualAttributes= info.wAttributes;
140 WORD previousAttributes= actualAttributes;
156 #if !ALIB_CHARACTERS_WIDE
157 WriteConsoleA( H, actual.
Buffer(), (DWORD) actual.
Length(), &ignore, NULL );
159 WriteConsoleW( H, actual.
Buffer(), (DWORD) actual.
Length(), &ignore, NULL );
171 bool isForeGround=
true;
172 if( c ==
'C' || c ==
'c' )
174 isForeGround= c==
'c';
184 ? FOREGROUND_INTENSITY
188 if ( colNo >= 0 && colNo < 6) attr= (win32Cols[colNo] | light);
190 else if ( colNo == 6 ) attr= W32C_BLACK;
191 else if ( colNo == 7 ) attr= W32C_WHITE;
192 else if ( colNo == 8 ) attr= light ? W32C_GRAY_LIGHT : W32C_GRAY_DARK;
200 actualAttributes= isForeGround ? ( actualAttributes & W32C_FOREGROUND_MASK ) | attr
201 : ( actualAttributes & W32C_BACKGROUND_MASK ) | (attr << 4);
215 else if ( c ==
't' || c ==
'A' )
218 int extraSpace= c >=
'0' && c <=
'9' ? (int) ( c -
'0' )
219 : (int) ( c -
'A' ) + 10;
224 integer qtySpaces= tabStop - column;
229 while (qtySpaces >= spaces.Length() ) {
230 WriteConsoleA( H, spaces.Buffer(), (DWORD) spaces.Length(), &ignore, NULL );
231 qtySpaces-= spaces.Length();
234 WriteConsoleA( H, spaces.Buffer(), (DWORD) qtySpaces, &ignore, NULL );
243 actualAttributes= ( actualAttributes & W32C_FOREGROUND_MASK )
246 ? FOREGROUND_INTENSITY
255 ALIB_WARNING(
"ALOX",
"WindowsConsoleLogger: Unknown ESC code" );
266 std::cout << std::endl;
static constexpr character GRAY[4]
Select gray color for foreground.
static constexpr character RED[4]
Select red color for foreground.
static constexpr character BLUE[4]
Select blue color for foreground.
textlogger::ColorfulLoggerParameters CFP
ALIB_DLL WindowsConsoleLogger(const NString &name=nullptr)
virtual ALIB_DLL void logText(detail::Domain &domain, Verbosity verbosity, AString &msg, detail::ScopeInfo &scope, int lineNumber)
WORD originalConsoleAttributes
The attributes that were set on the windows console at the time this object was created.
virtual ALIB_DLL void AcknowledgeLox(detail::LoxImpl *lox, lang::ContainerOp op) override
virtual ALIB_DLL void AcknowledgeLox(detail::LoxImpl *lox, lang::ContainerOp op) override
Variable varFormatMetaInfo
ALIB_DLL TextLogger(const NString &pName, const NString &typeName, bool pUsesStdStreams)
Variable varFormatAutoSizes
constexpr integer Length() const
constexpr bool IsNotEmpty() const
constexpr const TChar * Buffer() const
integer WStringLength() const
TString< TChar > Substring(integer regionStart, integer regionLength=MAX_LEN) const
@ Tabstop
denotes a tab stop entry.
ALIB_DLL TSubstring< TChar > & Next(lang::Whitespaces trimming=lang::Whitespaces::Trim, TChar newDelim='\0')
TSubstring< TChar > Actual
ALIB_DLL bool Define(Priority requestedPriority=Priority::Standard)
#define ALIB_WARNING(domain,...)
#define ALIB_ASSERT_WARNING(cond, domain,...)
#define ALIB_ASSERT_RESULT_NOT_EQUALS( func, value)
ContainerOp
Denotes standard container operations.
@ Insert
Denotes insertions.
@ Keep
Keep whitespaces in string.
This namespaces defines class TextLogger and its helpers.
@ CONSOLE_LIGHT_COLORS
Denotes configuration variable ALOX/CONSOLE_LIGHT_COLORS used by colorful specializations of class Te...
@ CODEPAGE
Denotes configuration variable ALOX/CODEPAGE used by class WindowsConsoleLogger.
variables::Variable CampVariable(camp::Camp &camp)
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace alib.
strings::util::TTokenizer< character > Tokenizer
Type alias in namespace alib.
variables::Variable Variable
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
strings::TString< nchar > NString
Type alias in namespace alib.
characters::nchar nchar
Type alias in namespace alib.
lox::ALoxCamp ALOX
The singleton instance of ALib Camp class ALoxCamp.
characters::character character
Type alias in namespace alib.
strings::TSubstring< character > Substring
Type alias in namespace alib.
Parameters specific to colorful loggers. As of today, this simply has one attribute.
@ Foreground
Use light colors for foreground.
@ Never
Never use light colors.
@ Background
Use light colors for background.