Overview   Class List   Class Hierarchy   Class Members   Functions & Constants   Defines   Header Files  

uima::LogFacility Class Reference

List of all members.

Detailed Description

The class LogFacility logs user-related information for debugging or error recording purposes.

The log messages are written to one or more loggers registered with the ResourceManager.

     if(myErrorOccured)
        {
        // my annotator couldn't create a result file for this document:
        // report an error but continue execution
        getAnnotatorContext().getLogger().logError("Could not create result file");
        // continue execution
        }
To log more complex messages which might consist of the concatenation of many elements you can use the LogStream provided by LogFacility:
     if(myErrorOccured)
        {
        // my annotator couldn't create a result file for this document:
        // report an error but continue execution
        // get a error log stream object
        LogStream & errStream =
           getAnnotatorContext().getLogger().getLogStream(LogStream::EnError);
        // stream out error message
        errStream << "Could not create result file" << strFilename << endl;
        errStream << "(continuing execution)";
        // terminate error message
        errStream.flush();
        // continue execution
        }
Instead of the multi-line sequence of statements you can use one of the defines we provide: UIMA_LOG_STREAM, UIMA_LOG_STREAM_MESSAGE, UIMA_LOG_STREAM_WARNING and UIMA_LOG_STREAM_ERROR The example above can be written with UIMA_LOG_STREAM_ERROR as follows
     UIMA_LOG_STREAM_ERROR(getAnnotatorContext().getLogger(),
        "Could not create result file" << strFilename << endl
        << "(continuing execution)");


Public Member Functions

Constructors
 LogFacility (icu::UnicodeString const &)
 this constructor gets handle to the loggers from the ResourceManager and sets the mininum log level to INFO.
 LogFacility (icu::UnicodeString const &, LogStream::EnEntryType level)
 this constructor gets the handle to loggers from the ResourceManager.
 ~LogFacility ()
Properties
const TCHARgetLastErrorAsCStr (void) const
ErrorInfo const & getLastError () const
LogStream Functions
LogStreamgetLogStream (LogStream::EnEntryType enLogEntryType)
void flushLogStream ()
Log Functions
void logMessage (const TCHAR *cpszMessage, long lUserCode=0) const
 Log the specified message together with a user-defined id.
void logMessage (const std::string &crclMessage, long lUserCode=0) const
 Log the specified message together with a user-defined id.
void logMessage (const icu::UnicodeString &crclMessage, long lUserCode=0) const
 Log the specified message together with a user-defined id.
void logWarning (const TCHAR *cpszMessage, long lUserCode=0) const
 Log the specified warning together with a user-defined id.
void logWarning (const std::string &crclMessage, long lUserCode=0) const
 Log the specified warning together with a user-defined id.
void logWarning (const icu::UnicodeString &crclMessage, long lUserCode=0) const
 Log the specified warning together with a user-defined id.
void logWarning (const ErrorInfo &crclErrorInfo) const
 Log the specified warning.
void logError (const TCHAR *cpszMessage, long lUserCode=0) const
 Log the specified error together with a user-defined id.
void logError (const std::string &crclMessage, long lUserCode=0) const
 Log the specified error together with a user-defined id.
void logError (const icu::UnicodeString &crclMessage, long lUserCode=0) const
 Log the specified error together with a user-defined id.
void logError (const ErrorInfo &crclErrorInfo) const
 Log the specified error.


Constructor & Destructor Documentation

uima::LogFacility::LogFacility icu::UnicodeString const &   ) 
 

this constructor gets handle to the loggers from the ResourceManager and sets the mininum log level to INFO.

This is used in the AnnotatorContext to create separate instances of the LogFacility for each annotator.

uima::LogFacility::LogFacility icu::UnicodeString const &  ,
LogStream::EnEntryType  level
 

this constructor gets the handle to loggers from the ResourceManager.

This constructor is used by the framework ResourceManager

uima::LogFacility::~LogFacility  ) 
 


Member Function Documentation

const TCHAR* uima::LogFacility::getLastErrorAsCStr void   )  const
 

ErrorInfo const& uima::LogFacility::getLastError  )  const
 

LogStream& uima::LogFacility::getLogStream LogStream::EnEntryType  enLogEntryType  ) 
 

void uima::LogFacility::flushLogStream  ) 
 

void uima::LogFacility::logMessage const TCHAR cpszMessage,
long  lUserCode = 0
const [inline]
 

Log the specified message together with a user-defined id.

void uima::LogFacility::logMessage const std::string &  crclMessage,
long  lUserCode = 0
const [inline]
 

Log the specified message together with a user-defined id.

void uima::LogFacility::logMessage const icu::UnicodeString &  crclMessage,
long  lUserCode = 0
const [inline]
 

Log the specified message together with a user-defined id.

void uima::LogFacility::logWarning const TCHAR cpszMessage,
long  lUserCode = 0
const [inline]
 

Log the specified warning together with a user-defined id.

void uima::LogFacility::logWarning const std::string &  crclMessage,
long  lUserCode = 0
const [inline]
 

Log the specified warning together with a user-defined id.

void uima::LogFacility::logWarning const icu::UnicodeString &  crclMessage,
long  lUserCode = 0
const [inline]
 

Log the specified warning together with a user-defined id.

void uima::LogFacility::logWarning const ErrorInfo crclErrorInfo  )  const
 

Log the specified warning.

void uima::LogFacility::logError const TCHAR cpszMessage,
long  lUserCode = 0
const [inline]
 

Log the specified error together with a user-defined id.

void uima::LogFacility::logError const std::string &  crclMessage,
long  lUserCode = 0
const [inline]
 

Log the specified error together with a user-defined id.

void uima::LogFacility::logError const icu::UnicodeString &  crclMessage,
long  lUserCode = 0
const [inline]
 

Log the specified error together with a user-defined id.

void uima::LogFacility::logError const ErrorInfo crclErrorInfo  )  const
 

Log the specified error.


The documentation for this class was generated from the following file:
Generated on Mon Oct 1 16:04:13 2012 for UIMACPP API by  doxygen 1.3.9.1