/*
 * SPDX-FileCopyrightText: 2000-2002 Copyright LifeLine Networks BV (www.lifeline.nl)
 * SPDX-FileCopyrightText: 2000-2002 Copyright Bastiaan Bakker
 * SPDX-FileCopyrightText: 2004 Copyright contributors to the cppTango project
 *
 * SPDX-License-Identifier: LGPL-3.0-or-later
 */

#ifndef TANGO_COMMON_LOG4TANGO_OSTREAMAPPENDER_H
#define TANGO_COMMON_LOG4TANGO_OSTREAMAPPENDER_H

#include <tango/common/log4tango/LayoutAppender.h>
#include <tango/common/log4tango/Portability.h>

#include <iostream>
#include <string>

namespace log4tango
{

//-----------------------------------------------------------------------------
// class : OstreamAppender (appends LoggingEvents to ostreams)
//-----------------------------------------------------------------------------
class OstreamAppender : public LayoutAppender
{
  public:
    OstreamAppender(const std::string &name, std::ostream *stream);
    ~OstreamAppender() override;

    bool reopen() override;
    void close() override;

  protected:
    int _append(const LoggingEvent &event) override;
    std::ostream *_stream;
};

} // namespace log4tango

#endif // TANGO_COMMON_LOG4TANGO_OSTREAMAPPENDER_HH
