OpcUaCanOpen
CANopen OPC-UA server
LogRecord.h
Go to the documentation of this file.
1 /* © Copyright CERN, 2015. All rights not expressly granted are reserved.
2  * LogRecord.h
3  *
4  * Created on: Aug 18, 2015
5  * Author: Benjamin Farnham <benjamin.farnham@cern.ch>
6  *
7  * This file is part of Quasar.
8  *
9  * Quasar is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU Lesser General Public Licence as published by
11  * the Free Software Foundation, either version 3 of the Licence.
12  *
13  * Quasar is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Lesser General Public Licence for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with Quasar. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef LOGRECORD_H_
23 #define LOGRECORD_H_
24 
25 #include <stdint.h>
26 #include <sstream>
27 #include "LogLevels.h"
28 #include "LogItStaticDefinitions.h"
29 
30 class LogRecord
31 {
32 public:
33  SHARED_LIB_EXPORT_DEFN LogRecord(const std::string& file, const int& line, const Log::LOG_LEVEL& level);
34  SHARED_LIB_EXPORT_DEFN LogRecord(const std::string& file, const int& line, const Log::LOG_LEVEL& level, const Log::LogComponentHandle& componentHandle);
35  SHARED_LIB_EXPORT_DEFN LogRecord(const std::string& file, const int& line, const Log::LOG_LEVEL& level, const std::string& componentName);
36 
38 
39  SHARED_LIB_EXPORT_DEFN std::ostream& getStream();
40 
41 private:
42  static const std::string stripDirectory(const std::string& file);
43  std::ostringstream& initializeStream(const std::string& file, const int& line, const Log::LOG_LEVEL& level);
44  std::ostringstream m_stream;
45 };
46 
47 
48 
49 #endif /* LOGRECORD_H_ */