A text logger that either removes or ignores (just writes through) ALox ESC sequences. Implements abstract method logText and introduces two new abstract methods logSubstring and notifyLogOp.
Definition at line 27 of file plaintextlogger.hpp.
|
enum | LightColorUsage { Auto,
Never,
Foreground,
Background
} |
|
static ALIB_API SmartLock | StdOutputStreams |
|
virtual ALIB_API | ~TextLogger () override |
|
virtual ALIB_API void | AcknowledgeLox (LoxImpl *lox, ContainerOp op) override |
|
virtual ALIB_API void | ClearReplacements () |
|
virtual ALIB_API void | Log (Domain &domain, Verbosity verbosity, Boxes &logables, ScopeInfo &scope) override |
|
virtual ALIB_API void | ResetAutoSizes () |
|
virtual ALIB_API void | SetReplacement (const String &searched, const String &replacement) |
|
virtual | ~Logger () |
|
const NString & | GetName () const |
|
const NString & | GetTypeName () const |
|
| SmartLock () |
|
void | Acquire (const NCString &dbgFile, int dbgLine, const NCString &dbgFunc) |
|
ALIB_API int | AddAcquirer (ThreadLock *newAcquirer) |
|
ALIB_API int | CntAcquirers () |
|
ALIB_API void | Release () |
| defined(ALIB_DOX) More...
|
|
ALIB_API int | RemoveAcquirer (ThreadLock *acquirer) |
|
ALIB_API | ThreadLock (Safeness safeness=Safeness::Safe) |
|
ALIB_API | ~ThreadLock () |
|
ALIB_API void | Acquire (const NCString &dbgFile, int dbgLine, const NCString &dbgFunc) |
|
int | CountAcquirements () const |
|
Thread * | GetOwner () const |
|
Safeness | GetSafeness () const |
|
bool | IsOwnedByCurrentThread () const |
|
ALIB_API void | Release () |
| defined(ALIB_DOX) More...
|
|
ALIB_API void | SetSafeness (Safeness safeness) |
|
bool | WillRelease () const |
|
AString | logBuf |
|
AString | msgBuf |
|
std::vector< AString > | replacements |
|
int | stdStreamLockRegistrationCounter =0 |
|
bool | usesStdStreams |
|
NString32 | Name |
|
NString32 | TypeName |
|
std::vector< ThreadLock * > | acquirers |
|
ThreadLockNR | lock |
|
uint16_t | cntAcquirements =0 |
|
std::mutex | mutex |
|
std::condition_variable | mutexNotifier |
|
std::thread::id | owner |
|
Safeness | safeness |
|
Abstract method to be implemented by descendants. Has to write the given region of the given string to the destination. Has to return the number of characters written, which might be different from the region length requested, e.g. in case of character set conversions.
If an error occurs, -1
can be returned to indicate that the current log should be aborted. In this case, no invocation of notifyLogOp(Phase::End) will be performed.
- Parameters
-
buffer | The string to write a portion of. |
start | The start of the portion in buffer to write out. |
length | The length of the portion in buffer to write out. |
- Returns
- The number of characters written, -1 on error.
Implemented in TextFileLogger, MemoryLogger, ConsoleLogger, and VStudioLogger.
virtual bool notifyLogOp |
( |
Phase |
phase | ) |
|
|
protectedpure virtual |
Abstract method to be implemented by descendants. This method is called when a new log message is started. It is called exactly once before a series of logSubstring() calls and exactly once after such series. If either the start or one of the calls to logSubstring returns false
, the second invocation that would indicate the end of a log message is omitted.
Implementing this method allows the acquisition of system resources (e.g. opening a file).
- Parameters
-
phase | Indicates the beginning or end of a log line. |
- Returns
- If
false
is returned, the log line is aborted without an invocation of notifyLogOp(Phase::End).
Implemented in TextFileLogger, MemoryLogger, ConsoleLogger, and VStudioLogger.
bool PruneESCSequences = true |
If this field is set to true
(the default), all ESC color and style codes get removed when logging into this Logger. ESC::TAB
is processed.
It might be useful, to set this to false, e.g. in the case, the contents of the Logger is (later) written into a different logger (e.g. as a multi line message) which is capable of interpreting the escape sequences of class ESC.
Definition at line 41 of file plaintextlogger.hpp.