10 #define W32C_FOREGROUND_MASK 0xFFF0
11 #define W32C_BACKGROUND_MASK 0xFF0F
14 #define W32C_RED FOREGROUND_RED
15 #define W32C_GREEN FOREGROUND_GREEN
16 #define W32C_BLUE FOREGROUND_BLUE
17 #define W32C_CYAN FOREGROUND_GREEN | FOREGROUND_BLUE
18 #define W32C_MAGENTA FOREGROUND_RED | FOREGROUND_BLUE
19 #define W32C_YELLOW FOREGROUND_RED | FOREGROUND_GREEN
20 #define W32C_WHITE FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY
22 #define W32C_GRAY_LIGHT FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE
23 #define W32C_GRAY_DARK FOREGROUND_INTENSITY
43 WORD actualAttributes;
45 HANDLE H= GetStdHandle(STD_OUTPUT_HANDLE);
46 CONSOLE_SCREEN_BUFFER_INFO info;
47 GetConsoleScreenBufferInfo( H, &info );
48 actualAttributes= info.wAttributes;
63 (void) useLightColors.
Define();
95 HANDLE H= GetStdHandle(STD_OUTPUT_HANDLE);
99 WORD actualAttributes;
101 CONSOLE_SCREEN_BUFFER_INFO info;
102 GetConsoleScreenBufferInfo( H, &info );
103 actualAttributes= info.wAttributes;
105 WORD previousAttributes= actualAttributes;
121 #if !ALIB_CHARACTERS_WIDE
122 WriteConsoleA( H, actual.
Buffer(), (DWORD) actual.
Length(), &ignore, NULL );
124 WriteConsoleW( H, actual.
Buffer(), (DWORD) actual.
Length(), &ignore, NULL );
136 bool isForeGround=
true;
137 if( c ==
'C' || c ==
'c' )
139 isForeGround= c==
'c';
149 ? FOREGROUND_INTENSITY
153 if ( colNo >= 0 && colNo < 6) attr= (win32Cols[colNo] | light);
155 else if ( colNo == 6 ) attr= W32C_BLACK;
156 else if ( colNo == 7 ) attr= W32C_WHITE;
157 else if ( colNo == 8 ) attr= light ? W32C_GRAY_LIGHT : W32C_GRAY_DARK;
165 actualAttributes= isForeGround ? ( actualAttributes & W32C_FOREGROUND_MASK ) | attr
166 : ( actualAttributes & W32C_BACKGROUND_MASK ) | (attr << 4);
180 else if ( c ==
't' || c ==
'A' )
183 int extraSpace= c >=
'0' && c <=
'9' ? (int) ( c -
'0' )
184 : (int) ( c -
'A' ) + 10;
189 integer qtySpaces= tabStop - column;
194 while (qtySpaces >= spaces.Length() ) {
195 WriteConsoleA( H, spaces.Buffer(), (DWORD) spaces.Length(), &ignore, NULL );
196 qtySpaces-= spaces.Length();
199 WriteConsoleA( H, spaces.Buffer(), (DWORD) qtySpaces, &ignore, NULL );
208 actualAttributes= ( actualAttributes & W32C_FOREGROUND_MASK )
211 ? FOREGROUND_INTENSITY
220 ALIB_WARNING(
"ALOX",
"WindowsConsoleLogger: Unknown ESC code" );
231 std::cout << std::endl;
#define ALIB_WARNING(domain,...)
#define ALIB_ASSERT_WARNING(cond, domain,...)
#define ALIB_ASSERT_RESULT_NOT_EQUALS( func, value)
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
WindowsConsoleLogger(const NString &name=nullptr)
virtual void logText(detail::Domain &domain, Verbosity verbosity, AString &msg, detail::ScopeInfo &scope, int lineNumber, bool isRecursion)
WORD originalConsoleAttributes
The attributes that were set on the windows console at the time this object was created.
virtual void AcknowledgeLox(detail::LoxImpl *lox, lang::ContainerOp op) override
virtual void AcknowledgeLox(detail::LoxImpl *lox, lang::ContainerOp op) override
Variable varFormatMetaInfo
TextLogger(const NString &pName, const NString &typeName)
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.
TSubstring< TChar > Actual
TSubstring< TChar > & Next(lang::Whitespaces trimming=lang::Whitespaces::Trim, TChar newDelim='\0')
bool Define(Priority requestedPriority=Priority::Standard)
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 #"alxcvALOX_CONSOLE_LIGHT_COLORS" used by colorful specializations of ...
@ CODEPAGE
Denotes configuration variable #"alxcvALOX_CODEPAGE" used by the class #"WindowsConsoleLogger".
variables::Variable CampVariable(camp::Camp &camp)
strings::TString< nchar > NString
Type alias in namespace #"%alib".
variables::Variable Variable
Type alias in namespace #"%alib".
strings::util::TTokenizer< character > Tokenizer
Type alias in namespace #"%alib".
lox::ALoxCamp ALOX
The singleton instance of ALib Camp class #"ALoxCamp".
lang::integer integer
Type alias in namespace #"%alib".
strings::TSubstring< character > Substring
Type alias in namespace #"%alib".
characters::nchar nchar
Type alias in namespace #"%alib".
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace #"%alib".
characters::character character
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.