|
Last change
on this file since c6a59b was ef9dff6, checked in by Frederik Heber <heber@…>, 11 years ago |
|
logger and errorLogger have new setOutputStream().
- this allows to redirect the logging streams in a program internally, e.g.
in a GUI setting.
- added unit test on this function.
- TESTFIX: LogUnitTest used loggerStub which made the tests useless.
|
-
Property mode
set to
100644
|
|
File size:
1009 bytes
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | * errorLogger.hpp
|
|---|
| 3 | *
|
|---|
| 4 | * Created on: Oct 19, 2009
|
|---|
| 5 | * Author: metzler
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #ifndef ERRORLOGGER_HPP_
|
|---|
| 9 | #define ERRORLOGGER_HPP_
|
|---|
| 10 |
|
|---|
| 11 | // include config.h
|
|---|
| 12 | #ifdef HAVE_CONFIG_H
|
|---|
| 13 | #include <config.h>
|
|---|
| 14 | #endif
|
|---|
| 15 |
|
|---|
| 16 | #include <iosfwd>
|
|---|
| 17 |
|
|---|
| 18 | #include "CodePatterns/Singleton.hpp"
|
|---|
| 19 |
|
|---|
| 20 | using namespace std;
|
|---|
| 21 |
|
|---|
| 22 | class Verbose;
|
|---|
| 23 |
|
|---|
| 24 | class errorLogger : public Singleton<errorLogger>{
|
|---|
| 25 | friend class Singleton<errorLogger>;
|
|---|
| 26 | public :
|
|---|
| 27 | static ostream *nix;
|
|---|
| 28 | static ostream *out;
|
|---|
| 29 | static ostream *defaultout;
|
|---|
| 30 | static int verbosity;
|
|---|
| 31 |
|
|---|
| 32 | static bool DoOutput();
|
|---|
| 33 | static void setVerbosity(int verbosityLevel);
|
|---|
| 34 | static int getVerbosity();
|
|---|
| 35 | static void setOutputStream(ostream *_newout);
|
|---|
| 36 |
|
|---|
| 37 | protected:
|
|---|
| 38 | /** Do not call this constructor directly, use getInstance() instead. */
|
|---|
| 39 | errorLogger();
|
|---|
| 40 | /** Do not call this destructor directly, use purgeInstance() instead. */
|
|---|
| 41 | ~errorLogger();
|
|---|
| 42 |
|
|---|
| 43 | };
|
|---|
| 44 |
|
|---|
| 45 | ostream& operator<<(class errorLogger&l, const Verbose& ost);
|
|---|
| 46 | ostream& operator<<(class errorLogger*l, const Verbose& ost);
|
|---|
| 47 |
|
|---|
| 48 | #endif /* ERRORLOGGER_HPP_ */
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.