Minor trace logging improvements.

Make all trace environment variable strings upper case and prefix with
KICAD_TRACE_ for consistency.

Add Doxygen group for the trace environment variable strings.
This commit is contained in:
Wayne Stambaugh 2017-09-21 08:58:08 -04:00
parent 8722fd9c6c
commit cb764d73c5
13 changed files with 77 additions and 42 deletions

View File

@ -55,7 +55,7 @@ static const unsigned char dummy_png[] = {
static const BITMAP_OPAQUE dummy_xpm[1] = {{ dummy_png, sizeof( dummy_png ), "dummy_xpm" }}; static const BITMAP_OPAQUE dummy_xpm[1] = {{ dummy_png, sizeof( dummy_png ), "dummy_xpm" }};
const wxString traceFindReplace( wxT( "KicadFindReplace" ) ); const wxString traceFindReplace = "KICAD_TRACE_FIND_REPLACE";
enum textbox { enum textbox {

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013-2015 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -50,7 +50,7 @@
#define URL_GET_INVOLVED "http://kicad-pcb.org/contribute/" #define URL_GET_INVOLVED "http://kicad-pcb.org/contribute/"
const wxChar traceAutoSave[] = wxT( "KicadAutoSave" ); const wxChar traceAutoSave[] = wxT( "KICAD_TRACE_AUTOSAVE" );
///@{ ///@{
/// \ingroup config /// \ingroup config

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr * Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 2007-2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2007 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -65,12 +65,11 @@ static const int CURSOR_SIZE = 12; ///< Cursor size in pixels
/** /**
* Trace mask used to enable or disable the trace output of coordinates during drawing * @ingroup trace_env_vars
* functions. The coordinate dumping can be turned on by setting the WXTRACE environment *
* variable to "kicad_dump_coords". See the wxWidgets documentation on wxLogTrace for * Flag to enable draw panel coordinate debug tracing.
* more information.
*/ */
#define KICAD_TRACE_COORDS wxT( "kicad_dump_coords" ) static const wxString kicadTraceCoords = wxT( "KICAD_TRACE_COORDS" );
// Events used by EDA_DRAW_PANEL // Events used by EDA_DRAW_PANEL
@ -314,7 +313,7 @@ void EDA_DRAW_PANEL::RefreshDrawingRect( const EDA_RECT& aRect, bool aEraseBackg
rect.width = dc.LogicalToDeviceXRel( rect.width ); rect.width = dc.LogicalToDeviceXRel( rect.width );
rect.height = dc.LogicalToDeviceYRel( rect.height ); rect.height = dc.LogicalToDeviceYRel( rect.height );
wxLogTrace( KICAD_TRACE_COORDS, wxLogTrace( kicadTraceCoords,
wxT( "Refresh area: drawing (%d, %d, %d, %d), device (%d, %d, %d, %d)" ), wxT( "Refresh area: drawing (%d, %d, %d, %d), device (%d, %d, %d, %d)" ),
aRect.GetX(), aRect.GetY(), aRect.GetWidth(), aRect.GetHeight(), aRect.GetX(), aRect.GetY(), aRect.GetWidth(), aRect.GetHeight(),
rect.x, rect.y, rect.width, rect.height ); rect.x, rect.y, rect.width, rect.height );
@ -371,7 +370,7 @@ void EDA_DRAW_PANEL::MoveCursor( const wxPoint& aPosition )
GetScrollPixelsPerUnit( &xPpu, &yPpu ); GetScrollPixelsPerUnit( &xPpu, &yPpu );
CalcUnscrolledPosition( screenPos.x, screenPos.y, &drawingPos.x, &drawingPos.y ); CalcUnscrolledPosition( screenPos.x, screenPos.y, &drawingPos.x, &drawingPos.y );
wxLogTrace( KICAD_TRACE_COORDS, wxLogTrace( kicadTraceCoords,
wxT( "MoveCursor() initial screen position(%d, %d) " ) \ wxT( "MoveCursor() initial screen position(%d, %d) " ) \
wxT( "rectangle(%d, %d, %d, %d) view(%d, %d)" ), wxT( "rectangle(%d, %d, %d, %d) view(%d, %d)" ),
screenPos.x, screenPos.y, clientRect.x, clientRect.y, screenPos.x, screenPos.y, clientRect.x, clientRect.y,
@ -389,7 +388,7 @@ void EDA_DRAW_PANEL::MoveCursor( const wxPoint& aPosition )
Scroll( x, y ); Scroll( x, y );
CalcScrolledPosition( drawingPos.x, drawingPos.y, &screenPos.x, &screenPos.y ); CalcScrolledPosition( drawingPos.x, drawingPos.y, &screenPos.x, &screenPos.y );
wxLogTrace( KICAD_TRACE_COORDS, wxLogTrace( kicadTraceCoords,
wxT( "MoveCursor() scrolled screen position(%d, %d) view(%d, %d)" ), wxT( "MoveCursor() scrolled screen position(%d, %d) view(%d, %d)" ),
screenPos.x, screenPos.y, x, y ); screenPos.x, screenPos.y, x, y );
} }
@ -488,7 +487,7 @@ void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event )
return; return;
} }
wxLogTrace( KICAD_TRACE_COORDS, wxLogTrace( kicadTraceCoords,
wxT( "Setting scroll bars ppuX=%d, ppuY=%d, unitsX=%d, unitsY=%d, posX=%d, posY=%d" ), wxT( "Setting scroll bars ppuX=%d, ppuY=%d, unitsX=%d, unitsY=%d, posX=%d, posY=%d" ),
ppux, ppuy, unitsX, unitsY, x, y ); ppux, ppuy, unitsX, unitsY, x, y );
@ -544,7 +543,7 @@ void EDA_DRAW_PANEL::SetClipBox( wxDC& aDC, const wxRect* aRect )
m_ClipBox.SetSize( wxSize( aDC.DeviceToLogicalXRel( clipBox.width ), m_ClipBox.SetSize( wxSize( aDC.DeviceToLogicalXRel( clipBox.width ),
aDC.DeviceToLogicalYRel( clipBox.height ) ) ); aDC.DeviceToLogicalYRel( clipBox.height ) ) );
wxLogTrace( KICAD_TRACE_COORDS, wxLogTrace( kicadTraceCoords,
wxT( "Device clip box=(%d, %d, %d, %d), Logical clip box=(%d, %d, %d, %d)" ), wxT( "Device clip box=(%d, %d, %d, %d), Logical clip box=(%d, %d, %d, %d)" ),
clipBox.x, clipBox.y, clipBox.width, clipBox.height, clipBox.x, clipBox.y, clipBox.width, clipBox.height,
m_ClipBox.GetX(), m_ClipBox.GetY(), m_ClipBox.GetWidth(), m_ClipBox.GetHeight() ); m_ClipBox.GetX(), m_ClipBox.GetY(), m_ClipBox.GetWidth(), m_ClipBox.GetHeight() );
@ -638,7 +637,7 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg )
// Verfies that the clipping is working correctly. If these two sets of numbers are // Verfies that the clipping is working correctly. If these two sets of numbers are
// not the same or really close. The clipping algorithms are broken. // not the same or really close. The clipping algorithms are broken.
wxLogTrace( KICAD_TRACE_COORDS, wxLogTrace( kicadTraceCoords,
wxT( "Clip box: (%d, %d, %d, %d), Draw extents (%d, %d, %d, %d)" ), wxT( "Clip box: (%d, %d, %d, %d), Draw extents (%d, %d, %d, %d)" ),
m_ClipBox.GetX(), m_ClipBox.GetY(), m_ClipBox.GetRight(), m_ClipBox.GetBottom(), m_ClipBox.GetX(), m_ClipBox.GetY(), m_ClipBox.GetRight(), m_ClipBox.GetBottom(),
DC->MinX(), DC->MinY(), DC->MaxX(), DC->MaxY() ); DC->MinX(), DC->MinY(), DC->MaxX(), DC->MaxY() );
@ -958,7 +957,7 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
if( event.GetWheelRotation() == 0 || !GetParent()->IsEnabled() if( event.GetWheelRotation() == 0 || !GetParent()->IsEnabled()
|| !rect.Contains( event.GetPosition() ) ) || !rect.Contains( event.GetPosition() ) )
{ {
wxLogTrace( KICAD_TRACE_COORDS, wxLogTrace( kicadTraceCoords,
wxT( "OnMouseWheel() position(%d, %d) rectangle(%d, %d, %d, %d)" ), wxT( "OnMouseWheel() position(%d, %d) rectangle(%d, %d, %d, %d)" ),
event.GetPosition().x, event.GetPosition().y, event.GetPosition().x, event.GetPosition().y,
rect.x, rect.y, rect.width, rect.height ); rect.x, rect.y, rect.width, rect.height );
@ -1422,7 +1421,7 @@ void EDA_DRAW_PANEL::OnPan( wxCommandEvent& event )
unitsX /= ppux; unitsX /= ppux;
unitsY /= ppuy; unitsY /= ppuy;
wxLogTrace( KICAD_TRACE_COORDS, wxLogTrace( kicadTraceCoords,
wxT( "Scroll center position before pan: (%d, %d)" ), tmpX, tmpY ); wxT( "Scroll center position before pan: (%d, %d)" ), tmpX, tmpY );
switch( event.GetId() ) switch( event.GetId() )
@ -1483,7 +1482,7 @@ void EDA_DRAW_PANEL::OnPan( wxCommandEvent& event )
center.y += KiROUND( (double) ( y - tmpY ) / scale ); center.y += KiROUND( (double) ( y - tmpY ) / scale );
GetParent()->SetScrollCenterPosition( center ); GetParent()->SetScrollCenterPosition( center );
wxLogTrace( KICAD_TRACE_COORDS, wxLogTrace( kicadTraceCoords,
wxT( "Scroll center position after pan: (%d, %d)" ), center.x, center.y ); wxT( "Scroll center position after pan: (%d, %d)" ), center.x, center.y );
} }

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2017 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -60,7 +60,7 @@ int LIB_PART::m_subpartIdSeparator = 0;
int LIB_PART::m_subpartFirstId = 'A'; int LIB_PART::m_subpartFirstId = 'A';
const wxChar traceSchLibMem[] = wxT( "KISCHLIBMEM" ); // public const wxChar traceSchLibMem[] = wxT( "KICAD_TRACE_SCH_LIB_MEM" ); // public
LIB_ALIAS::LIB_ALIAS( const wxString& aName, LIB_PART* aRootPart ): LIB_ALIAS::LIB_ALIAS( const wxString& aName, LIB_PART* aRootPart ):

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2017 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2017 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2017 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -61,7 +61,11 @@ enum LIBRENTRYOPTIONS
}; };
/// WXTRACE value to enable schematic library memory deletion debug output. /**
* @ingroup trace_env_vars
*
* Flag to enable schematic library memory deletion debug output.
*/
extern const wxChar traceSchLibMem[]; extern const wxChar traceSchLibMem[];

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -38,7 +38,7 @@
#include <general.h> #include <general.h>
const wxString traceFindItem( wxT( "KicadFindItem" ) ); const wxString traceFindItem = wxT( "KICAD_TRACE_FIND_ITEM" );
bool sort_schematic_items( const SCH_ITEM* aItem1, const SCH_ITEM* aItem2 ) bool sort_schematic_items( const SCH_ITEM* aItem1, const SCH_ITEM* aItem2 )

View File

@ -55,8 +55,13 @@ typedef std::vector< SCH_ITEMS_ITR > SCH_ITEMS_ITRS;
#define FMT_ANGLE SCH_ITEM::FormatAngle #define FMT_ANGLE SCH_ITEM::FormatAngle
/// Flag to enable find item tracing using the WXTRACE environment variable. This /**
/// flag generates a lot of debug output. * @ingroup trace_env_vars
*
* Flag to enable finding schematic item debug output.
*
* @warning This generates a log of debug output.
*/
extern const wxString traceFindItem; extern const wxString traceFindItem;

View File

@ -72,7 +72,12 @@
const char* delims = " \t\r\n"; const char* delims = " \t\r\n";
const wxChar traceSchLegacyPlugin[] = wxT( "KI_SCH_LEGACY_PLUGIN" ); /**
* @ingroup trace_env_vars
*
* Flag to enable legacy schematic plugin debug output.
*/
const wxChar traceSchLegacyPlugin[] = wxT( "KICAD_TRACE_SCH_LEGACY_PLUGIN" );
static bool is_eol( char c ) static bool is_eol( char c )

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2013-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2008-2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2008-2017 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2017 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2017 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -45,7 +45,21 @@ extern std::ostream& operator <<( std::ostream& out, const wxPoint& pt );
#endif #endif
/// Flag to enable find and replace tracing using the WXTRACE environment variable. /**
* @defgroup trace_env_vars Trace Environment Variables
*
* wxWidgets provides trace control of debug messages using the WXTRACE environment variable.
* This section defines the strings passed to WXTRACE to for debug output control of various
* sections of the KiCad code. See the wxWidgets <a href="http://docs.wxwidgets.org/3.0/
* group__group__funcmacro__log.html#ga947e317db477914c12b13c4534867ec9"> wxLogTrace </a>
* documentation for more information.
*/
/**
* @ingroup trace_env_vars
*
* Flag to enable find and replace debug tracing.
*/
extern const wxString traceFindReplace; extern const wxString traceFindReplace;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009-2015 Jean-Pierre Charras, jp.charras wanadoo.fr * Copyright (C) 2009-2015 Jean-Pierre Charras, jp.charras wanadoo.fr
* Copyright (C) 2011-2017 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -95,7 +95,11 @@ enum id_librarytype {
}; };
/// Custom trace mask to enable and disable auto save tracing. /**
* @ingroup trace_env_vars
*
* Flag to enable auto save feature debug tracing.
*/
extern const wxChar traceAutoSave[]; extern const wxChar traceAutoSave[];

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2012-2017 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2012 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -48,10 +48,11 @@
#include <memory.h> #include <memory.h>
/** /**
* Definition for enabling and disabling footprint library trace output. See the * @ingroup trace_env_vars
* wxWidgets documentation on using the WXTRACE environment variable. *
* Flag to enable GEDA PCB plugin debug output.
*/ */
static const wxString traceFootprintLibrary( wxT( "GedaPcbFootprintLib" ) ); static const wxString traceFootprintLibrary = wxT( "KICAD_TRACE_GEDA_PLUGIN" );
#ifdef DEBUG #ifdef DEBUG
static void inline traceParams( wxArrayString& aParams ) static void inline traceParams( wxArrayString& aParams )

View File

@ -56,10 +56,12 @@ using namespace PCB_KEYS_T;
#define FMTIU BOARD_ITEM::FormatInternalUnits #define FMTIU BOARD_ITEM::FormatInternalUnits
/** /**
* Definition for enabling and disabling footprint library trace output. See the * @ingroup trace_env_vars
* wxWidgets documentation on using the WXTRACE environment variable. *
* Flag to enable KiCad PCB plugin debug output.
*/ */
static const wxString traceFootprintLibrary( wxT( "KicadFootprintLib" ) ); static const wxString traceFootprintLibrary = wxT( "KICAD_TRACE_FP_PLUGIN" );
///> Removes empty nets (i.e. with node count equal zero) from net classes ///> Removes empty nets (i.e. with node count equal zero) from net classes
void filterNetClass( const BOARD& aBoard, NETCLASS& aNetClass ) void filterNetClass( const BOARD& aBoard, NETCLASS& aNetClass )

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -45,10 +45,11 @@
/** /**
* Definition for enabling and disabling print controller trace output. See the * @ingroup trace_env_vars
* wxWidgets documentation on using the WXTRACE environment variable. *
* Flag to enable PCB print controller debug output.
*/ */
static const wxString tracePrinting( wxT( "KicadPrinting" ) ); static const wxString tracePrinting = wxT( "KICAD_TRACE_PCB_PRINT" );
PRINT_PARAMETERS::PRINT_PARAMETERS() PRINT_PARAMETERS::PRINT_PARAMETERS()