activemq-cpp-3.8.2
LogRecord.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 #ifndef _DECAF_UTIL_LOGGING_LOGRECORD_H_
18 #define _DECAF_UTIL_LOGGING_LOGRECORD_H_
19 
20 #include <decaf/lang/Throwable.h>
23 #include <decaf/util/Config.h>
24 
25 #include <memory>
26 #include <string>
27 
28 namespace decaf{
29 namespace util{
30 namespace logging{
31 
42  private:
43 
44  // Level of this Record
45  Level level;
46 
47  // Name of the source Logger
48  std::string loggerName;
49 
50  // Name of the File that originated the Log
51  std::string sourceFile;
52 
53  // Line in the source file where log occurred
54  unsigned int sourceLine;
55 
56  // The message to Log.
57  std::string message;
58 
59  // The function Name where the log occured
60  std::string functionName;
61 
62  // Time in Mills since UTC that this Record was logged
63  long long timeStamp;
64 
65  // Thread Id of the Thread that logged this Record
66  long long threadId;
67 
68  // A Throwable that is associated with this record
69  std::auto_ptr<decaf::lang::Throwable> thrown;
70 
71  public:
72 
73  LogRecord();
74 
75  virtual ~LogRecord();
76 
81  Level getLevel() const {
82  return level;
83  };
84 
89  void setLevel( Level value ) {
90  level = value;
91  };
92 
97  const std::string& getLoggerName() const {
98  return loggerName;
99  };
100 
105  void setLoggerName( const std::string& loggerName ) {
106  this->loggerName = loggerName;
107  };
108 
113  const std::string& getSourceFile() const {
114  return sourceFile;
115  };
116 
121  void setSourceFile( const std::string& sourceFile ) {
122  this->sourceFile = sourceFile;
123  };
124 
129  unsigned int getSourceLine() const {
130  return sourceLine;
131  };
132 
137  void setSourceLine( unsigned int sourceLine ) {
138  this->sourceLine = sourceLine;
139  };
140 
145  const std::string& getMessage() const {
146  return message;
147  };
148 
153  void setMessage( const std::string& message ) {
154  this->message = message;
155  };
156 
161  const std::string& getSourceFunction() const {
162  return functionName;
163  };
164 
169  void setSourceFunction( const std::string& functionName ) {
170  this->functionName = functionName;
171  };
172 
177  long long getTimestamp() const { return timeStamp; };
178 
183  void setTimestamp( long long timeStamp ) {
184  this->timeStamp = timeStamp;
185  };
186 
191  long long getTreadId() const {
192  return threadId;
193  };
194 
199  void setTreadId( long long threadId ) {
200  this->threadId = threadId;
201  };
202 
208  return this->thrown.get();
209  }
210 
220  this->thrown.reset( thrown );
221  }
222 
223  };
224 
225 }}}
226 
227 #endif /*_DECAF_UTIL_LOGGING_LOGRECORD_H_*/
void setTreadId(long long threadId)
Sets the Thread Id where this Log was created.
Definition: LogRecord.h:199
const std::string & getMessage() const
Gets the Message to be Logged.
Definition: LogRecord.h:145
void setMessage(const std::string &message)
Sets the Message to be Logged.
Definition: LogRecord.h:153
This class represents an error that has occurred.
Definition: Throwable.h:44
The Level class defines a set of standard logging levels that can be used to control logging output...
Definition: Level.h:56
decaf::lang::Throwable * getThrown() const
Gets any Throwable associated with this LogRecord.
Definition: LogRecord.h:207
long long getTreadId() const
Gets the Thread Id where this Log was created.
Definition: LogRecord.h:191
LogRecord objects are used to pass logging requests between the logging framework and individual log ...
Definition: LogRecord.h:41
const std::string & getSourceFunction() const
Gets the name of the function where this log was logged.
Definition: LogRecord.h:161
void setLevel(Level value)
Set the Level of this Log Record.
Definition: LogRecord.h:89
unsigned int getSourceLine() const
Gets the Source Log line number.
Definition: LogRecord.h:129
long long getTimestamp() const
Gets the time in mills that this message was logged.
Definition: LogRecord.h:177
const std::string & getLoggerName() const
Gets the Source Logger&#39;s Name.
Definition: LogRecord.h:97
void setThrown(decaf::lang::Throwable *thrown)
Sets the Throwable associated with this LogRecord, the pointer becomes the property of this instance ...
Definition: LogRecord.h:219
void setSourceFile(const std::string &sourceFile)
Sets the Source Log File Name.
Definition: LogRecord.h:121
#define DECAF_API
Definition: Config.h:29
void setLoggerName(const std::string &loggerName)
Sets the Source Logger&#39;s Name.
Definition: LogRecord.h:105
void setSourceLine(unsigned int sourceLine)
Sets the Source Log line number.
Definition: LogRecord.h:137
Level getLevel() const
Get Level of this log record.
Definition: LogRecord.h:81
void setTimestamp(long long timeStamp)
Sets the time in mills that this message was logged.
Definition: LogRecord.h:183
const std::string & getSourceFile() const
Gets the Source Log File name.
Definition: LogRecord.h:113
void setSourceFunction(const std::string &functionName)
Sets the name of the function where this log was logged.
Definition: LogRecord.h:169
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: AprPool.h:25