Apache Log4cxx  Version 1.6.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_NS
31{
32
33namespace spi
34{
36
45class LOG4CXX_EXPORT LoggingEvent :
46 public virtual helpers::Object
47{
48 public:
53
54 typedef spi::KeySet KeySet;
55
59
69 ( const LogString& logger
70 , const LevelPtr& level
71 , const LocationInfo& location
72 , LogString&& message
73 );
74
84 ( const LogString& logger
85 , const LevelPtr& level
86 , const LogString& message
87 , const LocationInfo& location
88 );
89
99 ( const LogString& logger
100 , const LevelPtr& level
101 , const LocationInfo& location
102 , helpers::AsyncBuffer&& messageAppender
103 );
104
106
108 const LevelPtr& getLevel() const;
109
111 const LogString& getLoggerName() const;
112
114 const LogString& getMessage() const;
115
118
122 static log4cxx_time_t getStartTime();
123
125 const LogString& getThreadName() const;
126
134
138 log4cxx_time_t getTimeStamp() const;
139
142 std::chrono::time_point<std::chrono::system_clock> getChronoTimeStamp() const;
143
146
155 bool getNDC(LogString& dest) const;
156
166 bool getMDC(const LogString& key, LogString& dest) const;
167
175
176#if LOG4CXX_ABI_VERSION <= 15
180 [[ deprecated( "Use LoadDC instead" ) ]]
181 void getMDCCopy() const;
182#endif
183
191 void LoadDC() const;
192
199 bool getProperty(const LogString& key, LogString& dest) const;
200
207
211 void setProperty(const LogString& key, const LogString& value);
212
217
218 private:
219 LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(LoggingEventPrivate, m_priv)
220
221 //
222 // prevent copy and assignment
223 //
225 LoggingEvent& operator=(const LoggingEvent&);
226
227};
228
231}
232}
233
234#endif //_LOG4CXX_SPI_LOGGING_EVENT_H
base class for java-like objects.
Definition object.h:106
This class represents the location of a logging statement.
Definition locationinfo.h:40
The data recorded for each logging request.
Definition loggingevent.h:47
const LogString & getMessage() const
The message provided in the logging request.
const LevelPtr & getLevel() const
The severity level of the logging request that generated this event.
const LocationInfo & getLocationInformation() const
The source code location where the logging request was made.
std::chrono::time_point< std::chrono::system_clock > getChronoTimeStamp() const
The value of the system clock at the time this logging event was created.
log4cxx_time_t getTimeStamp() const
The number of microseconds elapsed since 1970-01-01 at the time this logging event was created.
bool getMDC(const LogString &key, LogString &dest) const
Add the value associated with key to the end of dest.
bool getNDC(LogString &dest) const
Add the current nested diagnostic context to the end of dest.
void renderMessage()
Use the renderers to construct the message.
const LogString & getLoggerName() const
The name of the logger used to make the logging request.
KeySet getPropertyKeySet() const
The set of of the key values in the properties for the event.
void getMDCCopy() const
Obtain a copy of the current thread's diagnostic context data.
void setProperty(const LogString &key, const LogString &value)
Associate value with the property key.
LoggingEvent()
An empty event.
static log4cxx_time_t getStartTime()
The number of microseconds elapsed since 1970-01-01 at the time the application started.
spi::KeySet KeySet
Definition loggingevent.h:54
KeySet getMDCKeySet() const
The keys in the mapped diagnostic context for the event.
bool getProperty(const LogString &key, LogString &dest) const
Append onto dest the value associated with the property key.
const LogString & getRenderedMessage() const
The message provided in the logging request.
const LogString & getThreadName() const
The identity of the thread in which this logging event was created.
void LoadDC() const
Obtain a copy of the current thread's diagnostic context data.
const LogString & getThreadUserName() const
The name you gave to the thread in which this logging event was created.
Definition propertysetter.h:27
Definition appender.h:30
LOG4CXX_PTR_DEF(LoggerRepository)
LOG4CXX_LIST_DEF(HierarchyEventListenerList, HierarchyEventListenerPtr)
std::shared_ptr< LoggingEvent > LoggingEventPtr
Definition appender.h:32
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:158
#define END_LOG4CXX_CAST_MAP()
Definition object.h:152
#define DECLARE_LOG4CXX_OBJECT(object)
Definition object.h:43
#define BEGIN_LOG4CXX_CAST_MAP()
Definition object.h:146