/*
 * 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_LOGGINGEVENT_H
#define TANGO_COMMON_LOG4TANGO_LOGGINGEVENT_H

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

#include <chrono>
#include <string>
#include <thread>

namespace log4tango
{

/**
 * The internal representation of logging events. When a affirmative
 * logging decision is made a <code>LoggingEvent</code> instance is
 * created. This instance is passed around the different log4tango
 * components.
 *
 * <p>This class is of concern to those wishing to extend log4tango.
 **/
//-----------------------------------------------------------------------------
// struct : LoggingEvent
//-----------------------------------------------------------------------------
struct LoggingEvent
{
  public:
    /**
     * Instantiate a LoggingEvent from the supplied parameters.
     *
     * <p>Except <code>timeStamp</code> all the other fields of
     * <code>LoggingEvent</code> are filled when actually needed.
     * <p>
     * @param logger The logger of this event.
     * @param message  The message of this event.
     * @param level The level of this event.
     * @param file_path The file path where this event was generated.
     * @param line_number The line number where this event was generated.
     **/
    LoggingEvent(const std::string &logger,
                 const std::string &message,
                 Level::Value level,
                 const std::string &file_path,
                 int line_number);

    /** Copy constructor */
    LoggingEvent(const LoggingEvent &event);

    /** The logger name. */
    const std::string logger_name;

    /** The application supplied message of logging event. */
    const std::string message;

    /** Level of logging event. */
    Level::Value level;

    /** Name of thread in which this logging event was generated */
    std::string thread_name;

    /** id of thread in which this logging event was generated */
    std::thread::id thread_id;

    /** The number of seconds elapsed since the epoch
        (1/1/1970 00:00:00 UTC) until logging event was created. */
    std::chrono::system_clock::time_point timestamp;

    /** File path where the event was generated */
    const std::string file_path;

    /** Line number where the event was generated */
    const int line_number;

  private:
    /** Prevent implicit copy */
    const LoggingEvent &operator=(const LoggingEvent &);
};

} // namespace log4tango

#endif // TANGO_COMMON_LOG4TANGO_LOGGINGEVENT_H
