ConsoleLogger

consoledoc.h

More...

Logging

Determines the priority level and attention the logged entry gets when recorded.

Public Functions

bool

Attaches the logger to the console and begins writing to file.

bool

Detaches the logger from the console and stops writing to file.

Detailed Description

A class designed to be used as a console consumer and log the data it receives to a file.

Logging

LogLevel level 

Determines the priority level and attention the logged entry gets when recorded.

Public Functions

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");

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");