ConsoleLogger

Engine/source/console/consoleLogger.h

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

More...

Public User Defined

The level of log messages to log.

Private Types

Parent 

Private Attributes

bool

If false, it will clear the file before logging to it.

The file name to log to.

bool

True if it is currently consuming and logging.

File stream this object writes to.

Private Static Attributes

List of active ConsoleLoggers to send log messages to.

bool

This is for use with the default constructor.

Private Functions

bool
init()

Utility function, sets up the object (for script interface) returns true if successful.

log(const char * consoleLine)

The log function called by the consumer callback.

Public Functions

Default constructor, make sure to initalize.

ConsoleLogger(const char * fileName, bool append)

Constructor.

Destructor.

bool

Attach to the console and begin logging.

bool

Detach from the console and stop logging.

Returns the level of console messages to log.

bool

Console constructor.

Sets the level of console messages to log.

Public Static Functions

logCallback(U32 level, const char * consoleLine)

The callback for the console consumer.

Detailed Description

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

Public User Defined

ConsoleLogEntry::Level mLevel 

The level of log messages to log.

Private Types

typedef SimObject Parent 

Private Attributes

bool mAppend 

If false, it will clear the file before logging to it.

StringTableEntry mFilename 

The file name to log to.

bool mLogging 

True if it is currently consuming and logging.

FileStream mStream 

File stream this object writes to.

Private Static Attributes

Vector< ConsoleLogger * > mActiveLoggers 

List of active ConsoleLoggers to send log messages to.

bool smInitialized 

This is for use with the default constructor.

Private Functions

init()

Utility function, sets up the object (for script interface) returns true if successful.

log(const char * consoleLine)

The log function called by the consumer callback.

Parameters:

consoleLine

Line of text to log

Public Functions

ConsoleLogger()

Default constructor, make sure to initalize.

ConsoleLogger(const char * fileName, bool append)

Constructor.

Parameters:

fileName

File name to log to

append

If false, it will clear the file, then start logging, else it will append

~ConsoleLogger()

Destructor.

attach()

Attach to the console and begin logging.

Returns true if the action is successful

DECLARE_CONOBJECT(ConsoleLogger )

detach()

Detach from the console and stop logging.

Returns true if the action is successful

getLogLevel()

Returns the level of console messages to log.

processArguments(S32 argc, ConsoleValueRef * argv)

Reimplemented from: SimObject

setLogLevel(ConsoleLogEntry::Level level)

Sets the level of console messages to log.

Parameters:

level

Log level. Only items of the specified level or lower are logged.

Public Static Functions

initPersistFields()

logCallback(U32 level, const char * consoleLine)

The callback for the console consumer.

note:

This is a global callback, not executed per-instance.