#ifndef ARM_OCSD_ERROR_LOGGER_H_INCLUDED
#define ARM_OCSD_ERROR_LOGGER_H_INCLUDED
#include <string>
#include <vector>
#include "interfaces/trc_error_log_i.h"
#include "ocsd_error.h"
#include "ocsd_msg_logger.h"
class ocsdDefaultErrorLogger : public ITraceErrorLog
{
public:
ocsdDefaultErrorLogger();
virtual ~ocsdDefaultErrorLogger();
bool initErrorLogger(const ocsd_err_severity_t verbosity, bool bCreateOutputLogger = false);
virtual ocsdMsgLogger *getOutputLogger() { return m_output_logger; };
virtual void setOutputLogger(ocsdMsgLogger *pLogger);
virtual const ocsd_hndl_err_log_t RegisterErrorSource(const std::string &component_name);
virtual void LogError(const ocsd_hndl_err_log_t handle, const ocsdError *Error);
virtual void LogMessage(const ocsd_hndl_err_log_t handle, const ocsd_err_severity_t filter_level, const std::string &msg );
virtual const ocsd_err_severity_t GetErrorLogVerbosity() const { return m_Verbosity; };
virtual ocsdError *GetLastError() { return m_lastErr; };
virtual ocsdError *GetLastIDError(const uint8_t chan_id)
{
if(OCSD_IS_VALID_CS_SRC_ID(chan_id))
return m_lastErrID[chan_id];
return 0;
};
private:
void CreateErrorObj(ocsdError **ppErr, const ocsdError *p_from);
ocsdError *m_lastErr;
ocsdError *m_lastErrID[0x80];
ocsd_err_severity_t m_Verbosity;
ocsdMsgLogger *m_output_logger; bool m_created_output_logger;
std::vector<std::string> m_error_sources;
};
#endif