TTGlobal Reference
The TTGlobal
class provides a logging facility within TTClasses.
Also see TTCGlobal Usage.
Public Methods
This section summarizes then describes the TTGlobal
public methods.
Public Methods Summary
Method | Description |
---|---|
Disables TTClasses logging. |
|
Specifies the verbosity level of TTClasses logging. |
|
Specifies where TTClasses logging information should be sent. |
|
Returns the underlying ODBC environment object (type |
disableLogging()
static void disableLogging()
This method disables all TTClasses logging. Note that the following two statements are identical:
TTGlobal::disableLogging();
TTGlobal::setLogLevel(TTLog::TTLOG_NIL);
setLogLevel()
static void setLogLevel(TTLog::TTLOG_LEVEL level)
This method specifies the verbosity level of TTClasses logging. Table 3-1 describes TTClasses logging levels. The levels are cumulative.
Table 3-1 TTClasses Logging Levels
Logging level | Description |
---|---|
|
There is no logging. |
|
Logs fatal errors (serious misuse of TTClasses methods). |
|
Logs all errors, such as |
|
(Default) Also logs warnings and all calls to |
|
Also logs informational messages, such as calls to most methods on |
|
Also logs debugging information, such as all bound parameter values for each call to |
To set the logging level to TTLog::TTLOG_ERR
, for example, add the following line to your program:
TTGlobal::setLogLevel(TTLog::TTLOG_ERR);
setLogStream()
static void setLogStream(ostream& stream)
Specifies the file (ofstream
object) where TTClasses logging information should be sent. By default, if TTClasses logging is enabled, logging is to stderr
. Using this method, an application can specify logging to a file (or any other ostream&
), such as in the following example that sets logging to app_log.txt
:
ofstream log_file("app_log.txt");
TTGlobal::setLogStream(log_file);
sqlhenv()
static SQLHENV sqlhenv()
Retrieves the underlying ODBC environment object.