AnCH Framework  0.1
Another C++ Hack Framework
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
messageFormatter.hpp
1 /*
2  ANCH Framework: ANother C++ Hack is a C++ framework based on C++11 standard
3  Copyright (C) 2012 Vincent Lachenal
4 
5  This file is part of ANCH Framework.
6 
7  ANCH Framework is free software: you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  ANCH Framework is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with ANCH Framework. If not, see <http://www.gnu.org/licenses/>.
19 */
20 #ifndef _ANCH_LOGGER_FORMATTER_MESSAGE_FORMATTER_H_
21 #define _ANCH_LOGGER_FORMATTER_MESSAGE_FORMATTER_H_
22 
23 #include <iostream>
24 #include <vector>
25 #ifdef ANCH_BOOST_REGEX
26 #include <boost/regex.hpp>
27 #else
28 #include <regex>
29 #endif
30 
31 #include "logger/levels.hpp"
32 #include "logger/formatter/iFormatter.hpp"
33 
34 
35 namespace anch {
36  namespace logger {
37  namespace formatter {
38 
54  private:
55  // Attributes +
56 #ifdef ANCH_BOOST_REGEX
57 
58  const static boost::regex CONFIG_PATTERN;
59 #else
60 
61  const static std::regex CONFIG_PATTERN;
62 #endif
63 
65  std::vector<anch::logger::formatter::IFormatter*> _formatters;
66  // Attributes -
67 
68  public:
69  // Constructors +
75  MessageFormatter(const std::string& linePattern);
76  // Constructors -
77 
78  // Destructor +
82  virtual ~MessageFormatter();
83  // Destructor -
84 
85  // Methods +
86  public:
96  const std::string formatMessage(const std::string& category,
97  const anch::logger::Level& level,
98  const std::string& message) const;
99 
100  private:
106  void addFormatter(const std::string& strFormatter);
107  // Methods -
108 
109  };
110 
111  }
112  }
113 }
114 
115 #endif // _ANCH_LOGGER_FORMATTER_MESSAGE_FORMATTER_H_
Definition: messageFormatter.hpp:53
AnCH framework base namespace.
Definition: base64.hpp:28
const std::string formatMessage(const std::string &category, const anch::logger::Level &level, const std::string &message) const
Definition: messageFormatter.cpp:139
MessageFormatter(const std::string &linePattern)
Definition: messageFormatter.cpp:66
Level
Definition: levels.hpp:34
virtual ~MessageFormatter()
Definition: messageFormatter.cpp:85