Frapper
1.0a
|
Static class for managing log messages. More...
#include <Log.h>
Public Types | |
enum | MessageType { MT_Info = 1, MT_Warning = 2, MT_Error = 4, MT_Debug = 8, MT_Qt = 16, MT_Ogre = 32 } |
Nested enumeration for the different types of log messages. More... | |
Static Public Member Functions | |
static void | initialize (bool useStandardStreams) |
Initializes private static data of the log message handler. | |
static void | finalize () |
Frees all resources that were used by private static data of the log message handler. | |
static void | loadIcons () |
Loads the icons for the different log message types. | |
static void | registerView (QTableView *tableView) |
Registers the given table view as an output widget for log messages. | |
static void | unregisterView (QTableView *tableView) |
Unregisters the given table view from the log message handler. | |
static void | info (const QString &message, const QString &function="") |
Adds the given text to the list of informational log messages. | |
static void | warning (const QString &message, const QString &function="") |
Adds the given text to the list of warning log messages. | |
static void | error (const QString &message, const QString &function="") |
Adds the given text to the list of error log messages. | |
static void | debug (const QString &message, const QString &function="") |
Adds the given text to the list of debugging log messages. | |
static void | na (const QString &function="") |
Adds a message to the list of warning log messages that the selected function is not available yet. | |
static void | addQtLogMessage (QtMsgType qtMessageType, const char *qtMessage) |
Adds the given text to the list of Qt log messages. | |
static void | addOgreLogMessage (const QString &message, const QString &logMessageLevel) |
Adds the given text to the list of OGRE log messages. | |
static void | setFilterEnabled (QTableView *tableView, bool enabled) |
Toggles filtering of log messages for the given table view. | |
static void | filter (QTableView *tableView, MessageType type, bool visible) |
Toggles a specific type of log messages in the given table view by making these messages visible or invisible. | |
static void | filter (QTableView *tableView, const QString &searchText) |
Filters log messages in the given table view by using a reg expression. | |
static void | clear () |
Clears the history of log messages. | |
static QString | getMessage (QStandardItemModel *model, int row) |
Builds a string representing the message with the given row index in the given item model. | |
Private Types | |
typedef QMap< int, QStandardItemModel * > | MessageModelMap |
Type definition for a map of message models by message type mask. | |
typedef QMap< int, QSortFilterProxyModel * > | ProxyModelMap |
Type definition for a map of proxy models by message type mask. | |
typedef QMap< Log::MessageType, bool > | MessageFilters |
Type definition for a map of log message types along with their activation values. | |
typedef QPair< bool, MessageFilters > | FilterSettings |
Type definition for a boolean value stating whether message filtering is enabled at all and the filters for the individual log message types. | |
typedef QMap< QTableView *, FilterSettings > | TableViewMap |
Type definition for the map of table views registered with the log message handler along with their filter settings. | |
Static Private Member Functions | |
static void | addMessage (MessageType messageType, const QString &message, const QString &function="") |
Adds the given text to the list of log messages. | |
static void | updateModel (QTableView *tableView) |
Fills the model that is used in the given table view with messages of types according to the active view filters. | |
static void | printToStandardOutput (const QString &header, const QString &message, const QString &function) |
Writes the given message preceeded by the given header text and the given function name (if available) to the standard output stream. | |
static void | printToStandardError (const QString &header, const QString &message, const QString &function) |
Writes the given message preceeded by the given header text and the given function name (if available) to the standard error stream. | |
Static Private Attributes | |
static bool | s_useStandardStreams = false |
Flag that states whether log messages should also be written to stdout and stderr. | |
static bool | s_initialized = false |
Flag that states whether the log message handler has been initialized. | |
static QStringList | s_headerLabels |
The list of header labels for the standard item models. | |
static MessageModelMap | s_messageModels |
The map of standard item models for all combinations of log message types. | |
static ProxyModelMap | s_proxyModels |
The map of proxy models for all combinations of log message types. | |
static TableViewMap | s_tableViews |
The nested map for storing registered table views and their message filters. | |
static QMap< MessageType, QIcon > | s_messageIcons |
The list of icons for the different log message types. | |
Static class for managing log messages.
|
private |
Type definition for a map of message models by message type mask.
|
private |
Type definition for a map of proxy models by message type mask.
|
private |
Type definition for a map of log message types along with their activation values.
|
private |
Type definition for a boolean value stating whether message filtering is enabled at all and the filters for the individual log message types.
|
private |
Type definition for the map of table views registered with the log message handler along with their filter settings.
|
static |
Initializes private static data of the log message handler.
Public Static Functions.
useStandardStreams | Flag to control whether to also output log messages to stdout and stderr. |
Initializes private static data of the log message handler.
useStandardStreams | Flag to control whether to also output log messages to stdout and stderr. |
|
static |
Frees all resources that were used by private static data of the log message handler.
|
static |
Loads the icons for the different log message types.
|
static |
Registers the given table view as an output widget for log messages.
tableView | The table view to register as an output widget. |
|
static |
Unregisters the given table view from the log message handler.
tableView | The table view to unregister from the log message handler. |
|
static |
Adds the given text to the list of informational log messages.
message | The text to add as an informational log message. |
function | The signature of the function that is reporting the message. |
|
static |
Adds the given text to the list of warning log messages.
message | The text to add as a warning log message. |
function | The signature of the function that is reporting the message. |
|
static |
Adds the given text to the list of error log messages.
message | The text to add as an error log message. |
function | The signature of the function that is reporting the message. |
|
static |
Adds the given text to the list of debugging log messages.
message | The text to add as a debugging log message. |
function | The signature of the function that is reporting the message. |
|
static |
Adds a message to the list of warning log messages that the selected function is not available yet.
function | The signature of the function that is reporting the message. |
|
static |
Adds the given text to the list of Qt log messages.
qtMessageType | The type of the Qt message. |
qtMessage | The message text. |
|
static |
Adds the given text to the list of OGRE log messages.
message | The text to add as an OGRE log message. |
logMessageLevel | The importance of the logged message. |
|
static |
Toggles filtering of log messages for the given table view.
tableView | The table view to enable or disable filtering for. |
enabled | Flag that controls whether to enable or disable filtering. |
enabled | Flag that controls whether to enable or disable filtering. |
|
static |
Toggles a specific type of log messages in the given table view by making these messages visible or invisible.
tableView | The table view to filter messages in. |
type | The type of log messages to filter. |
visible | Flag that controls whether to hide or show the messages. |
|
static |
Filters log messages in the given table view by using a reg expression.
searchText | The search text. |
|
static |
Clears the history of log messages.
|
static |
Builds a string representing the message with the given row index in the given item model.
|
staticprivate |
Adds the given text to the list of log messages.
Private Static Functions.
messageType | The type of log message to add. |
message | The text to add as a log message. |
function | The signature of the function that is reporting the message. |
Adds the given text to the list of log messages.
messageType | The type of log message to add. |
message | The text to add as a log message. |
function | The signature of the function that is reporting the message. |
|
staticprivate |
Fills the model that is used in the given table view with messages of types according to the active view filters.
tableView | The table view whose model to fill with log messages. |
|
staticprivate |
Writes the given message preceeded by the given header text and the given function name (if available) to the standard output stream.
header | The text to put before the message. |
message | The message to write to the standard output stream. |
function | The name of a function that reported the message. |
|
staticprivate |
Writes the given message preceeded by the given header text and the given function name (if available) to the standard error stream.
header | The text to put before the message. |
message | The message to write to the standard error stream. |
function | The name of a function that reported the message. |
|
staticprivate |
Flag that states whether log messages should also be written to stdout and stderr.
Private Static Data.
|
staticprivate |
Flag that states whether the log message handler has been initialized.
|
staticprivate |
The list of header labels for the standard item models.
|
staticprivate |
The map of standard item models for all combinations of log message types.
|
staticprivate |
The map of proxy models for all combinations of log message types.
The map of proxy item models for all combinations of log message types.
|
staticprivate |
The nested map for storing registered table views and their message filters.
|
staticprivate |
The list of icons for the different log message types.