Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
wiki:documentation:devguide:core:logger [2016/10/04 10:25] carolina.santos [Default Logger] |
wiki:documentation:devguide:core:logger [2016/10/04 13:58] (current) carolina.santos [References] |
||
|---|---|---|---|
| Line 14: | Line 14: | ||
| namespace core | namespace core | ||
| { | { | ||
| - | class TECOREEXPORT Logger | + | class Logger |
| { | { | ||
| /*! | /*! | ||
| Line 107: | Line 107: | ||
| * ''channel'': logger name. | * ''channel'': logger name. | ||
| - | * ''message'': message to be registered. | + | * ''message'': message to be logged. |
| It's possible to define your own logger macros, so that is not necessary to provide the logger name every time a log is made. | It's possible to define your own logger macros, so that is not necessary to provide the logger name every time a log is made. | ||
| Line 151: | Line 151: | ||
| </code> | </code> | ||
| - | **Note:** the messages will be registered in the correct channel if the following filter was added: ''Filter="%Channel% matches \"logger_name\""'' | + | **Note:** the messages will be logged in the correct channel if the following filter was added: ''Filter="%Channel% matches \"logger_name\""'' |
| The informations to create a configuration file are available in [[http://www.boost.org/doc/libs/1_60_0/libs/log/doc/html/index.html | Boost.Log]]. | The informations to create a configuration file are available in [[http://www.boost.org/doc/libs/1_60_0/libs/log/doc/html/index.html | Boost.Log]]. | ||
| Line 165: | Line 165: | ||
| Where: | Where: | ||
| - | * ''filename'': file where the log messages will be registered. | + | * ''filename'': file where messages will be logged. |
| The default logger of TerraLib consists of 6 macros that can be used to categorize messages in relevant levels: | The default logger of TerraLib consists of 6 macros that can be used to categorize messages in relevant levels: | ||
| <code cpp> | <code cpp> | ||
| - | TE_LOG_TRACE("Trace log") | + | TE_LOG_TRACE ("Trace log") |
| - | /* Utilizada dentro de funções que implementam algoritmos, com o propósito de ajudar a verificar o fluxo de execução dentro da função. | + | /* Used within functions which implement algorithms to check the flow of execution within the function. |
| - | Portanto, esta macro deve ser aplicada nos níveis mais internos do algoritmo sendo implementado. */ | + | Therefore, this macro should be applied in the inner levels of the algorithm being implemented. */ |
| - | + | ||
| - | TE_LOG_DEBUG("Debug log") | + | TE_LOG_DEBUG ("Debug log") |
| - | /* Utilizada para registrar mensagens que informem os valores de argumentos passados a uma função ou o valor de retorno dessa função. | + | /* Used to register messages to inform the values of arguments passed to a function or the return value of this function. |
| - | O propósito das mensagens é a depuração do sistema. */ | + | The purpose of the message is the system debugging. */ |
| TE_LOG_INFO("Information log") | TE_LOG_INFO("Information log") | ||
| - | /* Utilizada com mensagens que indiquem o progresso da aplicação ou de uma função. */ | + | /* Used with messages that indicate the progress of the application or a function. */ |
| TE_LOG_WARN("Warning log") | TE_LOG_WARN("Warning log") | ||
| - | /* Utilizada para registrar mensagens de situações consideradas inseguras para a aplicação. */ | + | /* Used to register considered unsafe situations messages to the application. */ |
| TE_LOG_ERROR("Error log") | TE_LOG_ERROR("Error log") | ||
| - | /* Utilizada para registrar mensagens de erro que não inviabilizem a continuação da aplicação. */ | + | /* Used to register error messages that do not impede the continued application. */ |
| TE_LOG_FATAL("Fatal log") | TE_LOG_FATAL("Fatal log") | ||
| - | /* Utilizada para registrar mensagens de eventos que inviabilizem a continuação da aplicação. */ | + | /* Used to register event messages that impede the continued application. */ |
| </code> | </code> | ||
| - | **Note:** watch out to the fact that should be avoided the use of macros like **TE_LOG_TRACE** and **TE_LOG_DEBUG** together with the message translation mechanism to avoid overhead involved in messages translation. | + | **Note:** be careful with the fact that the use of macros like **TE_LOG_TRACE** and **TE_LOG_DEBUG** together with the message translation mechanism should be avoided to prevent overhead involved in messages translation. |
| The application and TerraLib must be compiled with the level **TE_LOG_TRACE** disabled to prevent overcharging with the log record in the archives. | The application and TerraLib must be compiled with the level **TE_LOG_TRACE** disabled to prevent overcharging with the log record in the archives. | ||
| Line 203: | Line 203: | ||
| * ''Channel'': logger name. | * ''Channel'': logger name. | ||
| * ''Message'': message content. | * ''Message'': message content. | ||
| - | * ''Process'': process that registered the message. | + | * ''Process'': process that logged the message. |
| * ''ProcessID'': process id. | * ''ProcessID'': process id. | ||
| - | * ''ThreadID'': id of the thread that registered the message. | + | * ''ThreadID'': id of the thread that logged the message. |
| The attributes are used as follow: ''[%TimeStamp%] %Severity%: %Message%'' | The attributes are used as follow: ''[%TimeStamp%] %Severity%: %Message%'' | ||
| Line 251: | Line 251: | ||
| </code> | </code> | ||
| - | ===== References ===== | + | ===== Additional References ===== |
| * [[https://tools.ietf.org/html/rfc5424 | The Syslog Protocol]] | * [[https://tools.ietf.org/html/rfc5424 | The Syslog Protocol]] | ||