activemq-cpp-3.3.0

src/main/decaf/util/logging/LogRecord.h

Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one or more
00003  * contributor license agreements.  See the NOTICE file distributed with
00004  * this work for additional information regarding copyright ownership.
00005  * The ASF licenses this file to You under the Apache License, Version 2.0
00006  * (the "License"); you may not use this file except in compliance with
00007  * the License.  You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 #ifndef _DECAF_UTIL_LOGGING_LOGRECORD_H_
00018 #define _DECAF_UTIL_LOGGING_LOGRECORD_H_
00019 
00020 #include <decaf/lang/Throwable.h>
00021 #include <decaf/util/logging/LoggerCommon.h>
00022 #include <decaf/util/logging/Level.h>
00023 #include <decaf/util/Config.h>
00024 
00025 #include <memory>
00026 #include <string>
00027 
00028 namespace decaf{
00029 namespace util{
00030 namespace logging{
00031 
00041     class DECAF_API LogRecord {
00042     private:
00043 
00044         // Level of this Record
00045         Level level;
00046 
00047         // Name of the source Logger
00048         std::string loggerName;
00049 
00050         // Name of the File that originated the Log
00051         std::string sourceFile;
00052 
00053         // Line in the source file where log occurred
00054         unsigned int sourceLine;
00055 
00056         // The message to Log.
00057         std::string message;
00058 
00059         // The function Name where the log occured
00060         std::string functionName;
00061 
00062         // Time in Mills since UTC that this Record was logged
00063         long long timeStamp;
00064 
00065         // Thread Id of the Thread that logged this Record
00066         long long threadId;
00067 
00068         // A Throwable that is associated with this record
00069         std::auto_ptr<decaf::lang::Throwable> thrown;
00070 
00071     public:
00072 
00073         LogRecord();
00074 
00075         virtual ~LogRecord();
00076 
00081         Level getLevel() const {
00082             return level;
00083         };
00084 
00089         void setLevel( Level value ) {
00090             level = value;
00091         };
00092 
00097         const std::string& getLoggerName() const {
00098             return loggerName;
00099         };
00100 
00105         void setLoggerName( const std::string& loggerName ) {
00106             this->loggerName = loggerName;
00107         };
00108 
00113         const std::string& getSourceFile() const {
00114             return sourceFile;
00115         };
00116 
00121         void setSourceFile( const std::string& sourceFile ) {
00122             this->sourceFile = sourceFile;
00123         };
00124 
00129         unsigned int getSourceLine() const {
00130             return sourceLine;
00131         };
00132 
00137         void setSourceLine( unsigned int sourceLine ) {
00138             this->sourceLine = sourceLine;
00139         };
00140 
00145         const std::string& getMessage() const {
00146             return message;
00147         };
00148 
00153         void setMessage( const std::string& message ) {
00154             this->message = message;
00155         };
00156 
00161         const std::string& getSourceFunction() const {
00162             return functionName;
00163          };
00164 
00169         void setSourceFunction( const std::string& functionName ) {
00170             this->functionName = functionName;
00171         };
00172 
00177         long long getTimestamp() const { return timeStamp; };
00178 
00183         void setTimestamp( long long timeStamp ) {
00184             this->timeStamp = timeStamp;
00185         };
00186 
00191         long long getTreadId() const {
00192             return threadId;
00193         };
00194 
00199         void setTreadId( long long threadId ) {
00200             this->threadId = threadId;
00201         };
00202 
00207         decaf::lang::Throwable* getThrown() const {
00208             return this->thrown.get();
00209         }
00210 
00219         void setThrown( decaf::lang::Throwable* thrown ) {
00220             this->thrown.reset( thrown );
00221         }
00222 
00223     };
00224 
00225 }}}
00226 
00227 #endif /*_DECAF_UTIL_LOGGING_LOGRECORD_H_*/