Linaro / OpenCSD

CoreSight trace stream decoder developed openly
https://github.com/Linaro/opencsd/wiki
Other
141 stars 53 forks source link

Default error logger does not output to stderr as stated in prog_guide_main.md #39

Closed rbresalier closed 3 years ago

rbresalier commented 3 years ago

In prog_guide_main.md it states:

The DecodeTree will use a default error logger from the library - with a message logger that will output to stderr

However if I use a DecodeTree without calling any functions to setup/initialize loggers than nothing comes out of stderr.

Indeed one can see in ocsdDefaultErrorLogger::ocsdDefaultErrorLogger() that m_output_logger is initialized to 0:

ocsdDefaultErrorLogger::ocsdDefaultErrorLogger() :
    m_Verbosity(OCSD_ERR_SEV_ERROR),
    m_output_logger(0),
    m_created_output_logger(false)
{
...
}

This causes error messages to not come out due to m_output_logger is initialized to 0, from ocsdDefaultErrorLogger::LogError():

void ocsdDefaultErrorLogger::LogError(const ocsd_hndl_err_log_t handle, const ocsdError *Error)
{
    // only log errors that match or exceed the current verbosity
    if(m_Verbosity >= Error->getErrorSeverity())
    {
        // print out only if required
        if(m_output_logger)
        {
          ...
        }

So either documentation should say that default logger does not output anywhere (and either creation of a logger is required to output errors or need to call some functions to modify existing default logger), or OpenCSD library should be updated to indeed make the default logger go to stderr.

mikel-armbb commented 3 years ago

Thanks for raising this. Documentaiton fixed in 1.2.0 release