2012-04-08 03:59:47 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
*
|
|
|
|
* This file is part of Mapnik (c++ mapping toolkit)
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 Artem Pavlenko
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2012-04-09 03:00:51 +02:00
|
|
|
// mapnik
|
2012-04-08 03:59:47 +02:00
|
|
|
#include <mapnik/debug.hpp>
|
|
|
|
|
2012-04-09 12:05:49 +02:00
|
|
|
// stl
|
|
|
|
#include <ctime>
|
|
|
|
|
|
|
|
#ifndef MAPNIK_LOG_FORMAT
|
|
|
|
#define MAPNIK_LOG_FORMAT "Mapnik LOG> %Y-%m-%d %H:%M:%S:"
|
|
|
|
#endif
|
|
|
|
|
2012-04-09 03:00:51 +02:00
|
|
|
namespace mapnik { namespace logger {
|
|
|
|
|
2012-04-09 12:05:49 +02:00
|
|
|
// severity
|
2012-04-09 03:00:51 +02:00
|
|
|
|
|
|
|
severity::type severity::severity_level_ =
|
2012-04-09 12:05:49 +02:00
|
|
|
#ifdef MAPNIK_DEBUG
|
|
|
|
severity::debug
|
|
|
|
#else
|
|
|
|
severity::error
|
|
|
|
#endif
|
|
|
|
;
|
2012-04-09 03:00:51 +02:00
|
|
|
|
|
|
|
severity::severity_map severity::object_severity_level_ = severity::severity_map();
|
|
|
|
|
|
|
|
|
2012-04-09 12:05:49 +02:00
|
|
|
// format
|
|
|
|
|
|
|
|
#define __xstr__(s) __str__(s)
|
|
|
|
#define __str__(s) #s
|
|
|
|
|
|
|
|
std::string format::format_ = __xstr__(MAPNIK_LOG_FORMAT);
|
|
|
|
|
|
|
|
#undef __xstr__
|
|
|
|
#undef __str__
|
|
|
|
|
|
|
|
std::string format::str()
|
|
|
|
{
|
|
|
|
char buf[256];
|
|
|
|
const time_t tm = time(0);
|
|
|
|
strftime(buf, sizeof(buf), format::format_.c_str(), localtime(&tm));
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-04-09 03:00:51 +02:00
|
|
|
}
|
2012-04-08 03:59:47 +02:00
|
|
|
}
|