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

#ifndef LOGGERBASE_H_
#define LOGGERBASE_H_

#include "component/FailureMode.h"
#include "io/OutStream.h"
#include "logger/Syslog.h"
#include "Service.h"
#include "utils/CodedStr.h"
#include "utils/Timestamp.h"

/**
 *  Client-side interface for injecting log data into the log queue.
 *  Injects data messages into a logging queue.  This queue is then
 *  processed asynchronous to the logger call.
 *
 *  \ingroup logging
 */
class LoggerBase
{

public:

    /// Constructor
    LoggerBase( const char *facilityIn );

    /// Constructor
    LoggerBase( const Str &facilityIn );

    /// Setter, not allowed in Logger class
    virtual void setOutStream( OutStream& outStream )
    {
        this->outStream_ = &outStream;
    }

    /// Destructor
    virtual ~LoggerBase();

    /// Create a syslog entry, push into queue, C char* version
    void syslog( const char *msg, Syslog::Severity sev = Syslog::DEBUG, Service::ServiceType serviceType = Service::SERVICE_UNSPECIFIED );

    /// Create a syslog entry, push into queue, dual C char* version
    void syslog( const char *msgA, const char *msgB, Syslog::Severity sev = Syslog::DEBUG, Service::ServiceType serviceType = Service::SERVICE_UNSPECIFIED );

    /// Create a syslog entry, push into queue, C char*, size_t version
    void syslog( const char *msg, const size_t intMsg, Syslog::Severity sev = Syslog::DEBUG, Service::ServiceType serviceType = Service::SERVICE_UNSPECIFIED );

    /// Create a syslog entry, push into queue, C char*, int version
    void syslog( const char *msg, const int intMsg, Syslog::Severity sev = Syslog::DEBUG, Service::ServiceType serviceType = Service::SERVICE_UNSPECIFIED );

    /// Create a syslog entry, push into queue, C char*, double version
    void syslog( const char *msg, const double doubleMsg, Syslog::Severity sev = Syslog::DEBUG, Service::ServiceType serviceType = Service::SERVICE_UNSPECIFIED );

    /// Create a syslog entry, push into queue, C++ Str version
    virtual void syslog( const Str &msg, Syslog::Severity sev = Syslog::DEBUG, Service::ServiceType serviceType = Service::SERVICE_UNSPECIFIED );

    const Str& getFacility() const
    {
        return facility_;
    }

protected:

    /// Protected Constructor
    LoggerBase( const CodedStr& facilityIn );

    const CodedStr* facilityPtr_;

    const CodedStr& facility_;

    OutStream* outStream_;

};

#endif /*LOGGERBASE_H_*/
