From 78050c05e26bf4842a21cd56fb73fd9028dbd40f Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Wed, 17 Aug 2016 16:00:21 +0200 Subject: [PATCH] Changed PNS logging routine to wxLogTrace --- pcbnew/router/length_tuner_tool.cpp | 2 - pcbnew/router/pns_diff_pair_placer.cpp | 2 - pcbnew/router/pns_dp_meander_placer.cpp | 2 - pcbnew/router/pns_dragger.cpp | 2 +- pcbnew/router/pns_item.h | 2 - pcbnew/router/pns_kicad_iface.cpp | 13 +++---- pcbnew/router/pns_line.cpp | 2 +- pcbnew/router/pns_line_placer.cpp | 27 ++++++------- pcbnew/router/pns_meander.cpp | 2 - pcbnew/router/pns_meander_placer.cpp | 2 - pcbnew/router/pns_meander_skew_placer.cpp | 2 - pcbnew/router/pns_node.cpp | 17 ++++----- pcbnew/router/pns_router.cpp | 1 - pcbnew/router/pns_shove.cpp | 35 +++++++++-------- pcbnew/router/pns_tool_base.cpp | 10 +++-- pcbnew/router/router_tool.cpp | 3 +- pcbnew/router/trace.h | 46 ----------------------- 17 files changed, 52 insertions(+), 118 deletions(-) delete mode 100644 pcbnew/router/trace.h diff --git a/pcbnew/router/length_tuner_tool.cpp b/pcbnew/router/length_tuner_tool.cpp index 06f571e838..117abecb42 100644 --- a/pcbnew/router/length_tuner_tool.cpp +++ b/pcbnew/router/length_tuner_tool.cpp @@ -41,8 +41,6 @@ #include "length_tuner_tool.h" -#include "trace.h" - using namespace KIGFX; using boost::optional; diff --git a/pcbnew/router/pns_diff_pair_placer.cpp b/pcbnew/router/pns_diff_pair_placer.cpp index 457295d964..48930dc6af 100644 --- a/pcbnew/router/pns_diff_pair_placer.cpp +++ b/pcbnew/router/pns_diff_pair_placer.cpp @@ -22,8 +22,6 @@ #include #include -#include "trace.h" - #include "pns_node.h" #include "pns_walkaround.h" #include "pns_shove.h" diff --git a/pcbnew/router/pns_dp_meander_placer.cpp b/pcbnew/router/pns_dp_meander_placer.cpp index 6f4c894f18..62fb2fe53a 100644 --- a/pcbnew/router/pns_dp_meander_placer.cpp +++ b/pcbnew/router/pns_dp_meander_placer.cpp @@ -22,8 +22,6 @@ #include // God forgive me doing this... -#include "trace.h" - #include "pns_node.h" #include "pns_itemset.h" #include "pns_topology.h" diff --git a/pcbnew/router/pns_dragger.cpp b/pcbnew/router/pns_dragger.cpp index 8eca5b1dd2..42bc9a05fe 100644 --- a/pcbnew/router/pns_dragger.cpp +++ b/pcbnew/router/pns_dragger.cpp @@ -112,7 +112,7 @@ bool PNS_DRAGGER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) aStartItem->Unmark( MK_LOCKED ); - TRACE( 2, "StartDragging: item %p [kind %d]", aStartItem % aStartItem->Kind() ); + wxLogTrace( "PNS", "StartDragging: item %p [kind %d]", aStartItem, aStartItem->Kind() ); switch( aStartItem->Kind() ) { diff --git a/pcbnew/router/pns_item.h b/pcbnew/router/pns_item.h index 4f34f3ff47..24e1a3e527 100644 --- a/pcbnew/router/pns_item.h +++ b/pcbnew/router/pns_item.h @@ -26,8 +26,6 @@ #include #include -#include "trace.h" - #include "pns_layerset.h" class BOARD_CONNECTED_ITEM; diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index f353933c45..a4b37724b6 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -120,8 +120,7 @@ PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER( BOARD* aBoard, PNS_ROUTER* a ent.clearance = clearance; m_clearanceCache[i] = ent; - TRACE( 1, "Add net %d netclass %s clearance %d", i % netClassName.mb_str() % - clearance ); + wxLogTrace( "PNS", "Add net %d netclass %s clearance %d", i, netClassName.mb_str(), clearance ); } m_overrideEnabled = false; @@ -467,7 +466,7 @@ PNS_ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad ) break; default: - TRACE( 0, "unsupported pad type 0x%x", aPad->GetAttribute() ); + wxLogTrace( "PNS", "unsupported pad type 0x%x", aPad->GetAttribute() ); return NULL; } @@ -562,7 +561,7 @@ PNS_ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad ) break; default: - TRACEn( 0, "unsupported pad shape" ); + wxLogTrace( "PNS", "unsupported pad shape" ); delete solid; return NULL; } @@ -659,7 +658,7 @@ PNS_ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad ) } default: - TRACEn( 0, "unsupported pad shape" ); + wxLogTrace( "PNS", "unsupported pad shape" ); delete solid; return NULL; @@ -703,7 +702,7 @@ PNS_ITEM* PNS_KICAD_IFACE::syncVia( VIA* aVia ) void PNS_KICAD_IFACE::SetBoard( BOARD* aBoard ) { m_board = aBoard; - TRACE( 1, "m_board = %p\n", m_board ); + wxLogTrace( "PNS", "m_board = %p\n", m_board ); } @@ -711,7 +710,7 @@ void PNS_KICAD_IFACE::SyncWorld( PNS_NODE *aWorld ) { if( !m_board ) { - TRACEn( 0, "No board attached, aborting sync." ); + wxLogTrace( "PNS", "No board attached, aborting sync." ); return; } diff --git a/pcbnew/router/pns_line.cpp b/pcbnew/router/pns_line.cpp index cfeaaf5de8..7d54679a8c 100644 --- a/pcbnew/router/pns_line.cpp +++ b/pcbnew/router/pns_line.cpp @@ -345,7 +345,7 @@ void PNS_LINE::ShowLinks() return; } - wxLogTrace( "PNS", "line %p: %d linked segs\n", this, (int) m_segmentRefs->size() ); + wxLogTrace( "PNS", "line %p: %lu linked segs\n", this, (int) m_segmentRefs->size() ); for( int i = 0; i < (int) m_segmentRefs->size(); i++ ) wxLogTrace( "PNS", "seg %d: %p\n", i, (*m_segmentRefs)[i] ); diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp index 58a6aad313..2453c7cb9b 100644 --- a/pcbnew/router/pns_line_placer.cpp +++ b/pcbnew/router/pns_line_placer.cpp @@ -20,8 +20,6 @@ #include -#include "trace.h" - #include "pns_node.h" #include "pns_line_placer.h" #include "pns_walkaround.h" @@ -195,8 +193,8 @@ bool PNS_LINE_PLACER::handlePullback() m_direction = DIRECTION_45( last ); m_p_start = last.A; - TRACE( 0, "Placer: pullback triggered [%d] [%s %s]", - n % last_tail.Format().c_str() % first_head.Format().c_str() ); + wxLogTrace( "PNS", "Placer: pullback triggered [%d] [%s %s]", + n, last_tail.Format().c_str(), first_head.Format().c_str() ); // erase the last point in the tail, hoping that the next iteration will // result with a head trace that starts with a segment following our @@ -261,7 +259,7 @@ bool PNS_LINE_PLACER::reduceTail( const VECTOR2I& aEnd ) if( reduce_index >= 0 ) { - TRACE( 0, "Placer: reducing tail: %d", reduce_index ); + wxLogTrace( "PNS", "Placer: reducing tail: %d", reduce_index ); SHAPE_LINE_CHAIN reducedLine = new_direction.BuildInitialTrace( new_start, aEnd ); m_p_start = new_start; @@ -304,13 +302,13 @@ bool PNS_LINE_PLACER::mergeHead() if( n_head < 3 ) { - TRACEn( 4, "Merge failed: not enough head segs." ); + wxLogTrace( "PNS", "Merge failed: not enough head segs." ); return false; } if( n_tail && head.CPoint( 0 ) != tail.CPoint( -1 ) ) { - TRACEn( 4, "Merge failed: head and tail discontinuous." ); + wxLogTrace( "PNS", "Merge failed: head and tail discontinuous." ); return false; } @@ -346,7 +344,7 @@ bool PNS_LINE_PLACER::mergeHead() head.Remove( 0, n_head - 2 ); - TRACE( 0, "Placer: merge %d, new direction: %s", n_head % m_direction.Format().c_str() ); + wxLogTrace( "PNS", "Placer: merge %d, new direction: %s", n_head, m_direction.Format().c_str() ); head.Simplify(); tail.Simplify(); @@ -574,7 +572,7 @@ bool PNS_LINE_PLACER::optimizeTailHeadTransition() { PNS_LINE tmp( m_tail, opt_line ); - TRACE( 0, "Placer: optimize tail-head [%d]", threshold ); + wxLogTrace( "PNS", "Placer: optimize tail-head [%d]", threshold ); head.Clear(); tail.Replace( -threshold, -1, new_head.CLine() ); @@ -599,9 +597,8 @@ void PNS_LINE_PLACER::routeStep( const VECTOR2I& aP ) PNS_LINE new_head; - TRACE( 2, "INIT-DIR: %s head: %d, tail: %d segs\n", - m_initial_direction.Format().c_str() % m_head.SegmentCount() % - m_tail.SegmentCount() ); + wxLogTrace( "PNS", "INIT-DIR: %s head: %d, tail: %d segs\n", + m_initial_direction.Format().c_str(), m_head.SegmentCount(), m_tail.SegmentCount() ); for( i = 0; i < n_iter; i++ ) { @@ -789,8 +786,8 @@ void PNS_LINE_PLACER::initPlacement() setWorld( rootNode ); - TRACE( 1, "world %p, intitial-direction %s layer %d\n", - m_world % m_direction.Format().c_str() % aLayer ); + wxLogTrace( "PNS", "world %p, intitial-direction %s layer %d\n", + m_world, m_direction.Format().c_str(), m_currentLayer ); m_lastNode = NULL; m_currentNode = m_world; @@ -977,7 +974,7 @@ void PNS_LINE_PLACER::removeLoops( PNS_NODE* aNode, PNS_LINE& aLatest ) } } - TRACE( 0, "total segs removed: %d/%d\n", removedCount % total ); + wxLogTrace( "PNS", "total segs removed: %d/%d\n", removedCount, total ); } for( PNS_SEGMENT *s : toErase ) diff --git a/pcbnew/router/pns_meander.cpp b/pcbnew/router/pns_meander.cpp index e546bfee2f..d7408bbde7 100644 --- a/pcbnew/router/pns_meander.cpp +++ b/pcbnew/router/pns_meander.cpp @@ -20,8 +20,6 @@ #include // God forgive me doing this... -#include "trace.h" - #include "pns_node.h" #include "pns_itemset.h" #include "pns_topology.h" diff --git a/pcbnew/router/pns_meander_placer.cpp b/pcbnew/router/pns_meander_placer.cpp index f819345fcc..a67b145f7d 100644 --- a/pcbnew/router/pns_meander_placer.cpp +++ b/pcbnew/router/pns_meander_placer.cpp @@ -20,8 +20,6 @@ #include // God forgive me doing this... -#include "trace.h" - #include "pns_node.h" #include "pns_itemset.h" #include "pns_topology.h" diff --git a/pcbnew/router/pns_meander_skew_placer.cpp b/pcbnew/router/pns_meander_skew_placer.cpp index 2e516d0f4d..a9c6b88334 100644 --- a/pcbnew/router/pns_meander_skew_placer.cpp +++ b/pcbnew/router/pns_meander_skew_placer.cpp @@ -20,8 +20,6 @@ #include // God forgive me doing this... -#include "trace.h" - #include "pns_node.h" #include "pns_itemset.h" #include "pns_topology.h" diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp index aac6e233f4..a0bda083ef 100644 --- a/pcbnew/router/pns_node.cpp +++ b/pcbnew/router/pns_node.cpp @@ -28,7 +28,6 @@ #include #include -#include "trace.h" #include "pns_item.h" #include "pns_line.h" #include "pns_node.h" @@ -47,7 +46,7 @@ static boost::unordered_set allocNodes; PNS_NODE::PNS_NODE() { - TRACE( 0, "PNS_NODE::create %p", this ); + wxLogTrace( "PNS", "PNS_NODE::create %p", this ); m_depth = 0; m_root = this; m_parent = NULL; @@ -63,18 +62,18 @@ PNS_NODE::PNS_NODE() PNS_NODE::~PNS_NODE() { - TRACE( 0, "PNS_NODE::delete %p", this ); + wxLogTrace( "PNS", "PNS_NODE::delete %p", this ); if( !m_children.empty() ) { - TRACEn( 0, "attempting to free a node that has kids.\n" ); + wxLogTrace( "PNS", "attempting to free a node that has kids.\n" ); assert( false ); } #ifdef DEBUG if( allocNodes.find( this ) == allocNodes.end() ) { - TRACEn( 0, "attempting to free an already-free'd node.\n" ); + wxLogTrace( "PNS", "attempting to free an already-free'd node.\n" ); assert( false ); } @@ -108,7 +107,7 @@ PNS_NODE* PNS_NODE::Branch() { PNS_NODE* child = new PNS_NODE; - TRACE( 0, "PNS_NODE::branch %p (parent %p)", child % this ); + wxLogTrace( "PNS", "PNS_NODE::branch %p (parent %p)", child, this ); m_children.insert( child ); @@ -131,8 +130,8 @@ PNS_NODE* PNS_NODE::Branch() child->m_override = m_override; } - TRACE( 2, "%d items, %d joints, %d overrides", - child->m_index->Size() % child->m_joints.size() % child->m_override.size() ); + wxLogTrace( "PNS", "%d items, %lu joints, %lu overrides", + child->m_index->Size(), child->m_joints.size(), child->m_override.size() ); return child; } @@ -583,7 +582,7 @@ void PNS_NODE::addSegment( PNS_SEGMENT* aSeg, bool aAllowRedundant ) { if( aSeg->Seg().A == aSeg->Seg().B ) { - TRACEn( 0, "attempting to add a segment with same end coordinates, ignoring." ) + wxLogTrace( "PNS", "attempting to add a segment with same end coordinates, ignoring." ); return; } diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp index 264d9f1a8b..3af2fa4eca 100644 --- a/pcbnew/router/pns_router.cpp +++ b/pcbnew/router/pns_router.cpp @@ -33,7 +33,6 @@ #include #include -#include "trace.h" #include "pns_node.h" #include "pns_line_placer.h" #include "pns_line.h" diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp index 75da658f98..1e92445dc5 100644 --- a/pcbnew/router/pns_shove.cpp +++ b/pcbnew/router/pns_shove.cpp @@ -23,7 +23,6 @@ #include #include -#include "trace.h" #include "range.h" #include "pns_line.h" @@ -191,19 +190,19 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processHullSet( PNS_LINE& aCurrent, PNS_LINE& if( ( vFirst < 0 || vLast < 0 ) && !path.CompareGeometry( aObstacle.CLine() ) ) { - TRACE( 100, "attempt %d fail vfirst-last", attempt ); + wxLogTrace( "PNS", "attempt %d fail vfirst-last", attempt ); continue; } if( path.CPoint( -1 ) != obs.CPoint( -1 ) || path.CPoint( 0 ) != obs.CPoint( 0 ) ) { - TRACE( 100, "attempt %d fail vend-start\n", attempt ); + wxLogTrace( "PNS", "attempt %d fail vend-start\n", attempt ); continue; } if( !checkBumpDirection( aCurrent, l ) ) { - TRACE( 100, "attempt %d fail direction-check", attempt ); + wxLogTrace( "PNS", "attempt %d fail direction-check", attempt ); aShoved.SetShape( l.CLine() ); continue; @@ -211,7 +210,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processHullSet( PNS_LINE& aCurrent, PNS_LINE& if( path.SelfIntersecting() ) { - TRACE( 100, "attempt %d fail self-intersect", attempt ); + wxLogTrace( "PNS", "attempt %d fail self-intersect", attempt ); continue; } @@ -230,7 +229,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processHullSet( PNS_LINE& aCurrent, PNS_LINE& if( colliding ) { - TRACE( 100, "attempt %d fail coll-check", attempt ); + wxLogTrace( "PNS", "attempt %d fail coll-check", attempt ); continue; } @@ -587,7 +586,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc if( !jt ) { - TRACEn( 1, "weird, can't find the center-of-via joint\n" ); + wxLogTrace( "PNS", "weird, can't find the center-of-via joint\n" ); return SH_INCOMPLETE; } @@ -949,7 +948,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter ) case PNS_ITEM::VIA: { PNS_VIA* revVia = (PNS_VIA*) ni; - TRACE( 2, "iter %d: reverse-collide-via", aIter ); + wxLogTrace( "PNS", "iter %d: reverse-collide-via", aIter ); if( currentLine.EndsWithVia() && m_currentNode->CheckColliding( ¤tLine.Via(), revVia ) ) { @@ -966,7 +965,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter ) case PNS_ITEM::SEGMENT: { PNS_SEGMENT* seg = (PNS_SEGMENT*) ni; - TRACE( 2, "iter %d: reverse-collide-segment ", aIter ); + wxLogTrace( "PNS", "iter %d: reverse-collide-segment ", aIter ); PNS_LINE revLine = assembleLine( seg ); popLine(); @@ -986,7 +985,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter ) switch( ni->Kind() ) { case PNS_ITEM::SEGMENT: - TRACE( 2, "iter %d: collide-segment ", aIter ); + wxLogTrace( "PNS", "iter %d: collide-segment ", aIter ); st = onCollidingSegment( currentLine, (PNS_SEGMENT*) ni ); @@ -997,7 +996,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter ) break; case PNS_ITEM::VIA: - TRACE( 2, "iter %d: shove-via ", aIter ); + wxLogTrace( "PNS", "iter %d: shove-via ", aIter ); st = onCollidingVia( ¤tLine, (PNS_VIA*) ni ); if( st == SH_TRY_WALK ) @@ -1007,7 +1006,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter ) break; case PNS_ITEM::SOLID: - TRACE( 2, "iter %d: walk-solid ", aIter ); + wxLogTrace( "PNS", "iter %d: walk-solid ", aIter ); st = onCollidingSolid( currentLine, (PNS_SOLID*) ni ); break; @@ -1026,7 +1025,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveMainLoop() m_affectedAreaSum = OPT_BOX2I(); - TRACE( 1, "ShoveStart [root: %d jts, current: %d jts]", m_root->JointCount() % + wxLogTrace( "PNS", "ShoveStart [root: %d jts, current: %d jts]", m_root->JointCount(), m_currentNode->JointCount() ); int iterLimit = Settings().ShoveIterationLimit(); @@ -1144,8 +1143,8 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead ) m_currentNode->RemoveByMarker( MK_HEAD ); - TRACE( 1, "Shove status : %s after %d iterations", - ( ( st == SH_OK || st == SH_HEAD_MODIFIED ) ? "OK" : "FAILURE") % m_iter ); + wxLogTrace( "PNS", "Shove status : %s after %d iterations", + ( ( st == SH_OK || st == SH_HEAD_MODIFIED ) ? "OK" : "FAILURE"), m_iter ); if( st == SH_OK || st == SH_HEAD_MODIFIED ) { @@ -1241,8 +1240,8 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveMultiLines( const PNS_ITEMSET& aHeadSet m_currentNode->RemoveByMarker( MK_HEAD ); - TRACE( 1, "Shove status : %s after %d iterations", - ( st == SH_OK ? "OK" : "FAILURE") % m_iter ); + wxLogTrace( "PNS", "Shove status : %s after %d iterations", + ( st == SH_OK ? "OK" : "FAILURE"), m_iter ); if( st == SH_OK ) { @@ -1290,7 +1289,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveDraggingVia( PNS_VIA* aVia, const VECTOR { if( aNewVia ) { - wxLogTrace( "PNS","setNewV %p", m_draggedVia); + wxLogTrace( "PNS","setNewV %p", m_draggedVia ); *aNewVia = m_draggedVia; } diff --git a/pcbnew/router/pns_tool_base.cpp b/pcbnew/router/pns_tool_base.cpp index 5fe782a93d..d89a266dbb 100644 --- a/pcbnew/router/pns_tool_base.cpp +++ b/pcbnew/router/pns_tool_base.cpp @@ -55,8 +55,6 @@ using namespace std::placeholders; #include "pns_tune_status_popup.h" #include "pns_topology.h" -#include "trace.h" - using namespace KIGFX; TOOL_ACTION PNS_TOOL_BASE::ACT_RouterOptions( "pcbnew.InteractiveRouter.RouterOptions", @@ -185,7 +183,9 @@ PNS_ITEM* PNS_TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int a rv = NULL; if( rv ) - TRACE( 0, "%s, layer : %d, tl: %d", rv->KindStr().c_str() % rv->Layers().Start() % tl ); + { + wxLogTrace( "PNS", "%s, layer : %d, tl: %d", rv->KindStr().c_str(), rv->Layers().Start(), tl ); + } return rv; } @@ -307,7 +307,9 @@ void PNS_TOOL_BASE::updateEndItem( TOOL_EVENT& aEvent ) } if( m_endItem ) - TRACE( 0, "%s, layer : %d", m_endItem->KindStr().c_str() % m_endItem->Layers().Start() ); + { + wxLogTrace( "PNS", "%s, layer : %d", m_endItem->KindStr().c_str(), m_endItem->Layers().Start() ); + } } diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index e73b5cb800..dccbd3331a 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -54,7 +54,6 @@ using namespace std::placeholders; #include "router_tool.h" #include "pns_segment.h" #include "pns_router.h" -#include "trace.h" using namespace KIGFX; using boost::optional; @@ -296,7 +295,7 @@ void ROUTER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent ) switch( aEvent.KeyCode() ) { case '0': - TRACEn( 2, "saving drag/route log...\n" ); + wxLogTrace( "PNS", "saving drag/route log...\n" ); m_router->DumpLog(); break; } diff --git a/pcbnew/router/trace.h b/pcbnew/router/trace.h deleted file mode 100644 index c115b67881..0000000000 --- a/pcbnew/router/trace.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * KiRouter - a push-and-(sometimes-)shove PCB router - * - * Copyright (C) 2013 CERN - * Author: Tomasz Wlostowski - * - * 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. - * - * 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, see . - */ - -#ifndef __TRACE_H -#define __TRACE_H - -#include -#include -#include - -static inline void _trace_print( const char* aFuncName, int aLevel, const std::string& aMsg ) -{ -#ifdef DEBUG - std::cerr << "trace[" << aLevel << "]: " << aFuncName << ": " << aMsg << std::endl; -#endif -} - -#ifdef PNS_DEBUG - #define TRACE( level, fmt, ... ) \ - _trace_print( __FUNCTION__, level, ( boost::format( fmt ) % __VA_ARGS__ ).str() ); - - #define TRACEn( level, msg ) \ - _trace_print( __FUNCTION__, level, std::string( msg ) ); -#else - #define TRACE( ... ) - #define TRACEn( ... ) -#endif - -#endif