Belle II Software light-2406-ragdoll
|
Implements a log connection to an IO Stream. More...
#include <LogConnectionConsole.h>
Public Member Functions | |
LogConnectionConsole (int outputFD, bool color) | |
Constructor. | |
LogConnectionConsole (int outputFD) | |
Constructor which automatically enables color if the file descriptor is a terminal and supports colors. | |
~LogConnectionConsole () override | |
Destructor. | |
bool | sendMessage (const LogMessage &message) override |
Sends a log message. | |
void | write (const std::string &message) |
Send a preformatted string message to the connected output. | |
bool | isConnected () override |
Returns true if the connection to the io stream could be established. | |
void | finalizeOnAbort () override |
Make sure output is flushed on abort. | |
Static Public Member Functions | |
static bool | terminalSupportsColors (int fileDescriptor) |
Returns true if the given file descriptor is a tty and supports colors. | |
static bool | getPythonLoggingEnabled () |
Check whether console logging via python is enabled. | |
static void | setPythonLoggingEnabled (bool enabled) |
Set whether console logging via pyhthon is enabled. | |
static bool | getEscapeNewlinesEnabled () |
Check whether we want to escape newlines on console. | |
static void | setEscapeNewlinesEnabled (bool enabled) |
Set whether we want to escape newlines on console. | |
Private Attributes | |
int | m_fd |
The output stream used for sending the log message. | |
bool | m_color |
Flag for color output. | |
Static Private Attributes | |
static bool | s_pythonLoggingEnabled {false} |
Flag to indicate whether log messages should be sent to python sys.stdout. | |
static bool | s_escapeNewlinesEnabled {false} |
Flag to indicate whether newlines should be replaced by ' ' in the output. | |
Implements a log connection to an IO Stream.
Inherits from the abstract base class LogConnectionBase.
Definition at line 24 of file LogConnectionConsole.h.
LogConnectionConsole | ( | int | outputFD, |
bool | color | ||
) |
Constructor.
outputFD | The output file descriptor to write to |
color | whether color should be used for output |
Definition at line 23 of file LogConnectionConsole.cc.
|
inlineexplicit |
Constructor which automatically enables color if the file descriptor is a terminal and supports colors.
outputFD | The output file descriptor to write to. |
Definition at line 35 of file LogConnectionConsole.h.
|
override |
Destructor.
Definition at line 30 of file LogConnectionConsole.cc.
|
overridevirtual |
Make sure output is flushed on abort.
Reimplemented from LogConnectionBase.
Definition at line 98 of file LogConnectionConsole.cc.
|
inlinestatic |
Check whether we want to escape newlines on console.
Definition at line 60 of file LogConnectionConsole.h.
|
inlinestatic |
Check whether console logging via python is enabled.
Definition at line 56 of file LogConnectionConsole.h.
|
overridevirtual |
Returns true if the connection to the io stream could be established.
Implements LogConnectionBase.
Definition at line 35 of file LogConnectionConsole.cc.
|
overridevirtual |
Sends a log message.
message | The log message object. |
Implements LogConnectionBase.
Definition at line 64 of file LogConnectionConsole.cc.
|
inlinestatic |
Set whether we want to escape newlines on console.
Definition at line 62 of file LogConnectionConsole.h.
|
inlinestatic |
Set whether console logging via pyhthon is enabled.
Definition at line 58 of file LogConnectionConsole.h.
|
static |
Returns true if the given file descriptor is a tty and supports colors.
Definition at line 40 of file LogConnectionConsole.cc.
void write | ( | const std::string & | message | ) |
Send a preformatted string message to the connected output.
Definition at line 53 of file LogConnectionConsole.cc.
|
private |
Flag for color output.
Definition at line 67 of file LogConnectionConsole.h.
|
private |
The output stream used for sending the log message.
Definition at line 66 of file LogConnectionConsole.h.
|
staticprivate |
Flag to indicate whether newlines should be replaced by '
' in the output.
Definition at line 69 of file LogConnectionConsole.h.
|
staticprivate |
Flag to indicate whether log messages should be sent to python sys.stdout.
Definition at line 68 of file LogConnectionConsole.h.