2013-09-18 17:55:16 +00:00
|
|
|
/*
|
|
|
|
* KiRouter - a push-and-(sometimes-)shove PCB router
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013 CERN
|
|
|
|
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
2013-09-26 21:53:54 +00:00
|
|
|
*
|
2013-09-18 17:55:16 +00:00
|
|
|
* 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, either version 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
2013-09-26 21:53:54 +00:00
|
|
|
*
|
2013-09-18 17:55:16 +00:00
|
|
|
* 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.
|
2013-09-26 21:53:54 +00:00
|
|
|
*
|
2013-09-18 17:55:16 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.or/licenses/>.
|
|
|
|
*/
|
2013-09-26 21:53:54 +00:00
|
|
|
|
2013-09-18 17:55:16 +00:00
|
|
|
#ifndef __TRACE_H
|
|
|
|
#define __TRACE_H
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <iostream>
|
|
|
|
#include <boost/format.hpp>
|
|
|
|
|
2013-10-14 14:13:35 +00:00
|
|
|
static void _trace_print( const char* aFuncName, int level, const std::string& aMsg )
|
2013-09-18 17:55:16 +00:00
|
|
|
{
|
2013-10-14 14:13:35 +00:00
|
|
|
std::cerr << "trace[" << level << "]: " << aFuncName << ": " << aMsg << std::endl;
|
2013-09-18 17:55:16 +00:00
|
|
|
}
|
|
|
|
|
2013-09-26 21:53:54 +00:00
|
|
|
#define TRACE( level, fmt, ... ) \
|
2013-10-14 14:13:35 +00:00
|
|
|
_trace_print( __FUNCTION__, level, ( boost::format( fmt ) % __VA_ARGS__ ).str() );
|
2013-09-18 17:55:16 +00:00
|
|
|
|
2013-09-26 21:53:54 +00:00
|
|
|
#define TRACEn( level, msg ) \
|
|
|
|
_trace_print( __FUNCTION__, level, std::string( msg ) );
|
2013-09-18 17:55:16 +00:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
2013-09-26 21:53:54 +00:00
|
|
|
#define TRACE( level, fmt, ... )
|
|
|
|
#define TRACEn( level, msg )
|
2013-09-18 17:55:16 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|