source: src/CodePatterns/logger.hpp@ c6a59b

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: 954 bytes
Line 
1/*
2 * logger.hpp
3 *
4 * Created on: Oct 19, 2009
5 * Author: metzler
6 */
7
8#ifndef LOGGER_HPP_
9#define LOGGER_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
20using namespace std;
21
22class Verbose;
23
24class logger : public Singleton<logger> {
25 friend class Singleton<logger>;
26public :
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
37protected:
38 /** Do not call this constructor directly, use getInstance() instead. */
39 logger();
40 /** Do not call this destructor directly, use purgeInstance() instead. */
41 ~logger();
42};
43
44ostream& operator<<(class logger&l, const Verbose& ost);
45ostream& operator<<(class logger*l, const Verbose& ost);
46
47#endif /* LOGGER_HPP_ */
Note: See TracBrowser for help on using the repository browser.