blocxx
ScopeLogger.hpp
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright (C) 2005, Quest Software, Inc. All rights reserved.
3 * Copyright (C) 2006, Novell, Inc. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of
14 * Quest Software, Inc.,
15 * nor Novell, Inc.,
16 * nor the names of its contributors or employees may be used to
17 * endorse or promote products derived from this software without
18 * specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 *******************************************************************************/
32 
33 
43 #ifndef BLOCXX_SCOPE_LOGGER_HPP
44 #define BLOCXX_SCOPE_LOGGER_HPP
45 #include "blocxx/BLOCXX_config.h"
46 #include <iosfwd>
47 #include "blocxx/String.hpp"
48 #include "blocxx/LogAppender.hpp"
49 #include "blocxx/Logger.hpp"
50 #include "blocxx/DelayedFormat.hpp"
51 #include "blocxx/Reference.hpp"
52 
53 namespace BLOCXX_NAMESPACE
54 {
55 
61  class BLOCXX_COMMON_API ScopeLogger
62  {
63  public:
69  ScopeLogger(const String& entrance, const String& exit, const Logger& lgr);
76  ScopeLogger(const String& entrance, const String& exit, const String& component = Logger::STR_DEFAULT_COMPONENT, const LogAppenderRef& appender = LogAppenderRef());
77 
85  ScopeLogger(const String& entrance, const String& exit, const Reference<DelayedFormat>& format, const Logger& lgr);
94  ScopeLogger(const String& entrance, const String& exit, const Reference<DelayedFormat>& format, const String& component = Logger::STR_DEFAULT_COMPONENT, const LogAppenderRef& appender = LogAppenderRef());
95 
96  virtual ~ScopeLogger();
97 
98  private:
99  // Not implemented because there is no reason to copy this class. It is
100  // intended for a single scope only.
101  ScopeLogger(const ScopeLogger&);
102  ScopeLogger& operator=(const ScopeLogger&);
103 
107 
109  };
110 
111 } // end namespace BLOCXX_NAMESPACE
112 
113 #endif // BLOCXX_SCOPE_LOGGER_HPP