Stxxl  1.2.1
log.h
1 /***************************************************************************
2  * include/stxxl/bits/common/log.h
3  *
4  * Part of the STXXL. See http://stxxl.sourceforge.net
5  *
6  * Copyright (C) 2004-2005 Roman Dementiev <dementiev@ira.uka.de>
7  *
8  * Distributed under the Boost Software License, Version 1.0.
9  * (See accompanying file LICENSE_1_0.txt or copy at
10  * http://www.boost.org/LICENSE_1_0.txt)
11  **************************************************************************/
12 
13 #ifndef STXXL_LOG_HEADER
14 #define STXXL_LOG_HEADER
15 
16 #include <iostream>
17 #include <fstream>
18 
19 #include <stxxl/bits/namespace.h>
20 #include <stxxl/bits/singleton.h>
21 
22 
23 __STXXL_BEGIN_NAMESPACE
24 
25 class logger : public singleton<logger>
26 {
27  friend class singleton<logger>;
28 
29  std::ofstream log_stream_;
30  std::ofstream errlog_stream_;
31 
32  inline logger() :
33  log_stream_("stxxl.log"),
34  errlog_stream_("stxxl.errlog")
35  { }
36 
37 public:
38  inline std::ofstream & log_stream()
39  {
40  return log_stream_;
41  }
42 
43  inline std::ofstream & errlog_stream()
44  {
45  return errlog_stream_;
46  }
47 };
48 
49 __STXXL_END_NAMESPACE
50 
51 #endif // !STXXL_LOG_HEADER