Last change
on this file since 2604 was 1353, checked in by mar637, 17 years ago |
added explicit keyword for single arument constructors
|
-
Property svn:eol-style
set to
native
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
1.3 KB
|
Rev | Line | |
---|
[1106] | 1 | //
|
---|
| 2 | // C++ Interface: Logger
|
---|
| 3 | //
|
---|
| 4 | // Description:
|
---|
| 5 | //
|
---|
| 6 | //
|
---|
| 7 | // Author: Malte Marquarding <asap@atnf.csiro.au>, (C) 2005
|
---|
| 8 | //
|
---|
| 9 | // Copyright: See COPYING file that comes with this distribution
|
---|
| 10 | //
|
---|
| 11 | //
|
---|
[1102] | 12 | #ifndef ASAPLOGGER_H
|
---|
| 13 | #define ASAPLOGGER_H
|
---|
[717] | 14 |
|
---|
| 15 | #include <string>
|
---|
| 16 | #include <iostream>
|
---|
| 17 |
|
---|
| 18 | namespace asap {
|
---|
[1102] | 19 | /**
|
---|
| 20 | * This class provides the logging within asap. All other classes which need to log
|
---|
| 21 | * should inherit from this.
|
---|
| 22 | * @brief The ASAP logging class
|
---|
| 23 | * @author Malte Marquarding
|
---|
| 24 | * @date $Date: 2007-04-26 04:55:17 +0000 (Thu, 26 Apr 2007) $
|
---|
| 25 | * @version
|
---|
| 26 | */
|
---|
[890] | 27 | class Logger {
|
---|
[717] | 28 | public:
|
---|
[1102] | 29 | /**
|
---|
| 30 | * Default Constructor
|
---|
| 31 | **/
|
---|
[890] | 32 | Logger();
|
---|
[1102] | 33 |
|
---|
| 34 | /**
|
---|
| 35 | * Constructor with switch to enable/disable logging
|
---|
| 36 | * @param[in] enabled indicating the deafult state
|
---|
| 37 | */
|
---|
[1353] | 38 | explicit Logger(bool enabled);
|
---|
[1102] | 39 |
|
---|
| 40 | /*
|
---|
| 41 | * Destructor
|
---|
| 42 | */
|
---|
[1030] | 43 | virtual ~Logger();
|
---|
[1102] | 44 | /**
|
---|
| 45 | * push another message into the logger
|
---|
[1104] | 46 | * @param[in] s the message
|
---|
| 47 | * @param[in] newline whether to add a newline character at the end
|
---|
[1102] | 48 | */
|
---|
[883] | 49 | void pushLog(const std::string& s, bool newline=true) const;
|
---|
[1102] | 50 | /**
|
---|
| 51 | * pop the message form the logger
|
---|
[1104] | 52 | * @return the log message string
|
---|
[1102] | 53 | */
|
---|
[717] | 54 | std::string popLog() const;
|
---|
[1102] | 55 | /**
|
---|
| 56 | * enable logging
|
---|
| 57 | */
|
---|
[717] | 58 | virtual void enableLog();
|
---|
[1102] | 59 | /**
|
---|
| 60 | * disable logging
|
---|
| 61 | */
|
---|
[717] | 62 | virtual void disableLog();
|
---|
[1102] | 63 |
|
---|
[717] | 64 | private:
|
---|
| 65 | static std::string log_;
|
---|
| 66 | bool enabled_;
|
---|
| 67 | };
|
---|
| 68 |
|
---|
[1102] | 69 | } // namespace
|
---|
[717] | 70 |
|
---|
| 71 | #endif
|
---|
| 72 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.