Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET Apache Qpid Documentation
Logger.h
Go to the documentation of this file.
1 #ifndef QPID_LOG_LOGGER_H
2 #define QPID_LOG_LOGGER_H
3 
4 /*
5  * http://www.apache.org/licenses/LICENSE-2.0
6  *
7  * Unless required by applicable law or agreed to in writing, software
8  * distributed under the License is distributed on an "AS IS" BASIS,
9  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10  * See the License for the specific language governing permissions and
11  * limitations under the License.
12  *
13  */
14 
15 #include "qpid/log/Selector.h"
16 #include "qpid/log/Options.h"
17 #include "qpid/sys/Mutex.h"
18 #include <boost/ptr_container/ptr_vector.hpp>
19 #include <boost/noncopyable.hpp>
20 #include <set>
22 
23 namespace qpid {
24 namespace log {
25 
36 class QPID_COMMON_CLASS_EXTERN Logger : private boost::noncopyable {
37  public:
39  enum FormatFlag { FILE=1, LINE=2, FUNCTION=4, LEVEL=8, TIME=16, THREAD=32, HIRES=64, CATEGORY=128};
40 
50  class Output {
51  public:
53  QPID_COMMON_EXTERN virtual ~Output();
55  virtual void log(const Statement&, const std::string&) =0;
56  };
57 
58  QPID_COMMON_EXTERN static Logger& instance();
59 
62 
64  QPID_COMMON_EXTERN void select(const Selector& s);
65 
67  QPID_COMMON_EXTERN void format(int formatFlags);
68 
72  QPID_COMMON_EXTERN int format(const Options&);
73 
75  QPID_COMMON_EXTERN void configure(const Options& o);
76 
78  QPID_COMMON_EXTERN void reconfigure(const std::vector<std::string>& selectors);
79 
81  QPID_COMMON_EXTERN void add(Statement& s);
82 
84  QPID_COMMON_EXTERN void log(const Statement&, const std::string&);
85 
87  QPID_COMMON_EXTERN void output(std::auto_ptr<Output> out);
88 
90  QPID_COMMON_EXTERN void setPrefix(const std::string& prefix);
91 
93  QPID_COMMON_EXTERN void clear();
94 
96  QPID_COMMON_INLINE_EXTERN const Options& getOptions() const { return options; }
97 
98 
99  private:
100  typedef boost::ptr_vector<Output> Outputs;
101  typedef std::set<Statement*> Statements;
102 
103  sys::Mutex lock;
104  inline void enable_unlocked(Statement* s);
105 
106  Statements statements;
107  Outputs outputs;
108  Selector selector;
109  int flags;
110  std::string prefix;
111  Options options;
112 };
113 
114 }} // namespace qpid::log
115 
116 
117 #endif

Qpid C++ API Reference
Generated on Thu Feb 14 2013 for Qpid C++ Client API by doxygen 1.8.3