public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
Hongli Lai (Phusion) (author)
Sun Apr 20 02:38:39 -0700 2008
commit  0f0f5bb31161cd83c524aec5545f40912b844a6c
tree    81b2377c6889ce976a8dbbf31aa8aad5b2525dc7
parent  44b298528a5378baad28825620529c835deb7c6c
passenger / ext / apache2 / Logging.cpp
100644 49 lines (43 sloc) 1.354 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* Phusion Passenger - http://www.modrails.com/
* Copyright (C) 2008 Phusion
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <iostream>
#include <fstream>
#include "Logging.h"
 
namespace Passenger {
 
int _debugLevel = 2;
ostream *_logStream = &cerr;
ostream *_debugStream = &cerr;
 
void
setDebugFile(const char *logFile) {
  #ifdef PASSENGER_DEBUG
    if (logFile != NULL) {
      ostream *stream = new ofstream(logFile, ios_base::out | ios_base::app);
      if (stream->fail()) {
        delete stream;
      } else {
        if (_debugStream != NULL && _debugStream != &cerr) {
          delete _debugStream;
        }
        _debugStream = stream;
      }
    } else {
      _debugStream = &cerr;
    }
  #endif
}
 
} // namespace Passenger