activemq-cpp-3.6.0
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_*/