Apache Log4cxx Version 1.1.0
Loading...
Searching...
No Matches
loggingevent.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _LOG4CXX_SPI_LOGGING_EVENT_H
19#define _LOG4CXX_SPI_LOGGING_EVENT_H
20
21#include <log4cxx/logstring.h>
22#include <time.h>
23#include <log4cxx/logger.h>
24#include <log4cxx/mdc.h>
26#include <vector>
27#include <chrono>
28
29
30namespace log4cxx
31{
32namespace helpers
33{
34class ObjectOutputStream;
35}
36
37namespace spi
38{
40
49class LOG4CXX_EXPORT LoggingEvent :
50 public virtual helpers::Object
51{
52 public:
57
58 typedef spi::KeySet KeySet;
59
63
75 LoggingEvent(const LogString& logger,
76 const LevelPtr& level, const LogString& message,
77 const log4cxx::spi::LocationInfo& location);
78
80
82 const LevelPtr& getLevel() const;
83
85 const LogString& getLoggerName() const;
86
88 const LogString& getMessage() const;
89
91 const LogString& getRenderedMessage() const;
92
96 static log4cxx_time_t getStartTime();
97
99 const LogString& getThreadName() const;
100
105 const LogString& getThreadUserName() const;
106
109 log4cxx_time_t getTimeStamp() const;
110
111 std::chrono::time_point<std::chrono::system_clock> getChronoTimeStamp() const;
112
113 /* Return the file where this log statement was written. */
114 const log4cxx::spi::LocationInfo& getLocationInformation() const;
115
125 bool getNDC(LogString& dest) const;
126
143 bool getMDC(const LogString& key, LogString& dest) const;
144
152 KeySet getMDCKeySet() const;
153
158 void getMDCCopy() const;
159
166 bool getProperty(const LogString& key, LogString& dest) const;
173 KeySet getPropertyKeySet() const;
174
178 void setProperty(const LogString& key, const LogString& value);
179
180 private:
181 LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(LoggingEventPrivate, m_priv)
182
183 //
184 // prevent copy and assignment
185 //
187 LoggingEvent& operator=(const LoggingEvent&);
188 static const LogString& getCurrentThreadName();
189 static const LogString& getCurrentThreadUserName();
190
191};
192
193LOG4CXX_PTR_DEF(LoggingEvent);
194LOG4CXX_LIST_DEF(LoggingEventList, LoggingEventPtr);
195}
196}
197
198#endif //_LOG4CXX_SPI_LOGGING_EVENT_H
base class for java-like objects.
Definition: object.h:105
This class represents the location of a logging statement.
Definition: locationinfo.h:46
The internal representation of logging events.
Definition: loggingevent.h:51
spi::KeySet KeySet
Definition: loggingevent.h:58
LOG4CXX_LIST_DEF(HierarchyEventListenerList, HierarchyEventListenerPtr)
std::shared_ptr< LoggingEvent > LoggingEventPtr
Definition: appender.h:32
Definition: configuration.h:25
std::basic_string< logchar > LogString
Definition: logstring.h:60
std::shared_ptr< Level > LevelPtr
Definition: optionconverter.h:28
#define LOG4CXX_CAST_ENTRY(Interface)
Definition: object.h:157
#define END_LOG4CXX_CAST_MAP()
Definition: object.h:151
#define DECLARE_LOG4CXX_OBJECT(object)
Definition: object.h:42
#define BEGIN_LOG4CXX_CAST_MAP()
Definition: object.h:145