|
Public Member Functions | |
bool | attach () |
Attaches the logger to the console and begins writing to file. | |
bool | detach () |
Detaches the logger from the console and stops writing to file. | |
Public Attributes | |
Logging | |
LogLevel | level |
Determines the priority level and attention the logged entry gets when recorded. |
A class designed to be used as a console consumer and log the data it receives to a file.
bool ConsoleLogger::attach | ( | ) |
Attaches the logger to the console and begins writing to file.
// Create the logger // Will automatically start writing to testLogging.txt with normal priority new ConsoleLogger(logger, "testLogging.txt", false); // Send something to the console, with the logger consumes and writes to file echo("This is logged to the file"); // Stop logging, but do not delete the logger logger.detach(); echo("This is not logged to the file"); // Attach the logger to the console again logger.attach(); // Logging has resumed echo("Logging has resumed");
bool ConsoleLogger::detach | ( | ) |
Detaches the logger from the console and stops writing to file.
// Create the logger // Will automatically start writing to testLogging.txt with normal priority new ConsoleLogger(logger, "testLogging.txt", false); // Send something to the console, with the logger consumes and writes to file echo("This is logged to the file"); // Stop logging, but do not delete the logger logger.detach(); echo("This is not logged to the file"); // Attach the logger to the console again logger.attach(); // Logging has resumed echo("Logging has resumed");
Determines the priority level and attention the logged entry gets when recorded.