1 // Module:  Log4CPLUS
  2 // File:    loglog.h
  3 // Created: 6/2001
  4 // Author:  Tad E. Smith
  5 //
  6 //
  7 // Copyright (C) Tad E. Smith  All rights reserved.
  8 //
  9 // This software is published under the terms of the Apache Software
 10 // License version 1.1, a copy of which has been included with this
 11 // distribution in the LICENSE.APL file.
 12 //
 13 
 14 /** @file */
 15 
 16 #ifndef _LOG4CPLUS_HELPERS_LOGLOG
 17 #define _LOG4CPLUS_HELPERS_LOGLOG
 18 
 19 #include <log4cplus/config.h>
 20 #include <log4cplus/tstring.h>
 21 #include <log4cplus/helpers/pointer.h>
 22 #include <log4cplus/helpers/threads.h>
 23 
 24 
 25 namespace log4cplus {
 26     namespace helpers {
 27 
 28         /**
 29          * This class used to output log statements from within the log4cplus package.
 30          *
 31          * <p>Log4cplus components cannot make log4cplus logging calls. However, it is
 32          * sometimes useful for the user to learn about what log4cplus is
 33          * doing. You can enable log4cplus internal logging by defining the
 34          * <b>log4cplus.configDebug</b> variable.
 35          *
 36          * <p>All log4cplus internal debug calls go to <code>cout</code>
 37          * where as internal error messages are sent to
 38          * <code>cerr</code>. All internal messages are prepended with
 39          * the string "log4clus: ".
 40          */
 41         class LOG4CPLUS_EXPORT LogLog : public log4cplus::helpers::SharedObject {
 42         public:
 43           // Static methods
 44             /**
 45              * Returns a reference to the <code>LogLog</code> singleton.
 46              */
 47             static log4cplus::helpers::SharedObjectPtr<LogLog> getLogLog();
 48 
 49 
 50             /**
 51              * Allows to enable/disable log4cplus internal logging.
 52              */
 53             void setInternalDebugging(bool enabled);
 54 
 55             /**
 56              * In quite mode no LogLog generates strictly no output, not even
 57              * for errors. 
 58              *
 59              * @param quietMode A true for not
 60              */
 61             void setQuietMode(bool quietMode);
 62 
 63             /**
 64              * This method is used to output log4cplus internal debug
 65              * statements. Output goes to <code>std::cout</code>.
 66              */
 67             void debug(const log4cplus::tstring& msg);
 68 
 69             /**
 70              * This method is used to output log4cplus internal error
 71              * statements. There is no way to disable error statements.
 72              * Output goes to <code>std::cerr</code>.
 73              */
 74             void error(const log4cplus::tstring& msg);
 75 
 76             /**
 77              * This method is used to output log4cplus internal warning
 78              * statements. There is no way to disable warning statements.
 79              * Output goes to <code>std::cerr</code>.
 80              */
 81             void warn(const log4cplus::tstring& msg);
 82 
 83           // Dtor
 84             virtual ~LogLog();
 85 
 86           // Data
 87             LOG4CPLUS_MUTEX_PTR_DECLARE mutex;
 88 
 89         private:
 90           // Data
 91             bool debugEnabled;
 92             bool quietMode;
 93             const log4cplus::tstring PREFIX;
 94             const log4cplus::tstring WARN_PREFIX;
 95             const log4cplus::tstring ERR_PREFIX;
 96 
 97           // Ctors
 98             LogLog();
 99             LogLog(const LogLog&);
100         };
101 
102     } // end namespace helpers
103 } // end namespace log4cplus
104 
105 
106 #endif // _LOG4CPLUS_HELPERS_LOGLOG


syntax highlighted by Code2HTML, v. 0.9.1