/** \file
 *
 *  Contains the LcmSyslogBridge class definition.
 *
 *  Copyright (c) 2007,2008,2009,2020 MBARI
 *  MBARI Proprietary Information.  All Rights Reserved
 *
 */

#ifndef LCMSYSLOGBRIDGE_H_
#define LCMSYSLOGBRIDGE_H_

#include "data/LcmListener.h"
#include "component/Component.h"
#include "logger/Syslog.h"


/**
 * LcmSyslogBridge
 * Provides a flexible interface to the Syslog.
 *
 *  \ingroup data
 */
class LcmSyslogBridge: public LcmListener
{
public:

    LcmSyslogBridge( Component* owner, const Str& channel, lcm::LCM* lcm = NULL, short sourceID = ANY_SOURCE );

    /// Destructor
    virtual ~LcmSyslogBridge();

    void handleMessage( const lcm::ReceiveBuffer *rbuf,
                        const std::string &chan,
                        const TethysLcmTypes::LrauvLcmMessage *msg );

protected:

    /// Process syslog messages sent on LCM channel
    void processSyslogEntrys( const TethysLcmTypes::StringArray* syslogEntry );

    /// Posts syslog messages sent on LCM channel to LRAUV syslog
    void postSyslogEntry( Str& syslog_entry, Syslog::Severity severity );

    Component* owner_;

    bool debug_;
};


#endif /*SLATEBRIDGE_H_*/
