|
a/libupnpp/log.cxx |
|
b/libupnpp/log.cxx |
|
... |
|
... |
12 |
* You should have received a copy of the GNU General Public License
|
12 |
* You should have received a copy of the GNU General Public License
|
13 |
* along with this program; if not, write to the
|
13 |
* along with this program; if not, write to the
|
14 |
* Free Software Foundation, Inc.,
|
14 |
* Free Software Foundation, Inc.,
|
15 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
15 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
16 |
*/
|
16 |
*/
|
17 |
#include "config.h"
|
17 |
#include "libupnpp/config.h"
|
18 |
|
18 |
|
19 |
#include "log.hxx"
|
19 |
#include "log.hxx"
|
20 |
|
20 |
|
21 |
#include <errno.h> // for errno
|
21 |
#include <errno.h> // for errno
|
22 |
|
22 |
|
|
... |
|
... |
28 |
|
28 |
|
29 |
Logger::Logger(const std::string& fn)
|
29 |
Logger::Logger(const std::string& fn)
|
30 |
: m_tocerr(false), m_loglevel(LLDEB)
|
30 |
: m_tocerr(false), m_loglevel(LLDEB)
|
31 |
{
|
31 |
{
|
32 |
if (!fn.empty() && fn.compare("stderr")) {
|
32 |
if (!fn.empty() && fn.compare("stderr")) {
|
33 |
m_stream.open(fn, std::fstream::out | std::ofstream::trunc);
|
33 |
m_stream.open(fn.c_str(), std::fstream::out | std::ofstream::trunc);
|
34 |
if (!m_stream.is_open()) {
|
34 |
if (!m_stream.is_open()) {
|
35 |
cerr << "Logger::Logger: log open failed: for [" <<
|
35 |
cerr << "Logger::Logger: log open failed: for [" <<
|
36 |
fn << "] errno " << errno << endl;
|
36 |
fn << "] errno " << errno << endl;
|
37 |
m_tocerr = true;
|
37 |
m_tocerr = true;
|
38 |
}
|
38 |
}
|