STXXL  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
log.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * lib/common/log.cpp
3  *
4  * Part of the STXXL. See http://stxxl.sourceforge.net
5  *
6  * Copyright (C) 2004-2005 Roman Dementiev <[email protected]>
7  * Copyright (C) 2008 Johannes Singler <[email protected]>
8  * Copyright (C) 2009 Andreas Beckmann <[email protected]>
9  *
10  * Distributed under the Boost Software License, Version 1.0.
11  * (See accompanying file LICENSE_1_0.txt or copy at
12  * http://www.boost.org/LICENSE_1_0.txt)
13  **************************************************************************/
14 
15 #include <stxxl/bits/common/log.h>
16 #include <stxxl/bits/namespace.h>
17 
18 #include <cstdlib>
19 
21 
22 logger::logger() : waitlog_stream_(NULL)
23 {
24  const char* log_filename = getenv("STXXLLOGFILE");
25  log_stream_.open(log_filename == NULL ? "stxxl.log" : log_filename);
26  const char* errlog_filename = getenv("STXXLERRLOGFILE");
27  errlog_stream_.open(errlog_filename == NULL ? "stxxl.errlog" : errlog_filename);
28 #ifdef STXXL_WAIT_LOG_ENABLED
29  const char* waitlog_filename = getenv("STXXLWAITLOGFILE");
30  if (waitlog_filename) {
31  waitlog_stream_ = new std::ofstream(waitlog_filename);
32  *waitlog_stream_ << "# time\trd_incr\twr_incr\tw_read\tw_write" << std::endl;
33  }
34 #endif
35 }
36 
38 {
39  delete waitlog_stream_;
40 }
41 
#define STXXL_BEGIN_NAMESPACE
Definition: namespace.h:16
std::ofstream log_stream_
Definition: log.h:29
std::ofstream * waitlog_stream_
Definition: log.h:31
std::ofstream errlog_stream_
Definition: log.h:30
#define STXXL_END_NAMESPACE
Definition: namespace.h:17