Author: sh-sh-sh
Date: Fri Jan 18 16:16:01 2008
New Revision: 43742
URL: http://svn.opensuse.org/viewcvs/yast?rev=43742&view=rev
Log:
YCP-less logging
Modified:
trunk/core/libyui/src/YEvent.cc
trunk/core/libyui/src/YMacroPlayer.cc
trunk/core/libyui/src/YMacroPlayer.h
trunk/core/libyui/src/YMacroRecorder.cc
trunk/core/libyui/src/YSimpleEventHandler.cc
trunk/core/libyui/src/YUIPlugin.cc
trunk/core/libyui/src/YUI_builtins.cc
trunk/core/libyui/src/YUI_core.cc
trunk/core/libyui/src/YUI_util.cc
trunk/core/libyui/src/YUI_util.h
trunk/core/libyui/src/YWidget.cc
Modified: trunk/core/libyui/src/YEvent.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YEvent.cc?rev=43742&r1=43741&r2=43742&view=diff
==============================================================================
--- trunk/core/libyui/src/YEvent.cc (original)
+++ trunk/core/libyui/src/YEvent.cc Fri Jan 18 16:16:01 2008
@@ -18,8 +18,8 @@
-#define y2log_component "ui-events"
-#include
+#define YUILogComponent "ui-events"
+#include "YUILog.h"
#include
#include
#include
@@ -43,7 +43,7 @@
if ( ++_activeEvents > 3 )
{
- y2error( "Memory leak? %d active events", _activeEvents );
+ yuiError() << "Memory leak? " << _activeEvents << " active events!" << endl;
}
}
@@ -52,7 +52,7 @@
{
if ( --_activeEvents < 0 )
{
- y2error( "FATAL: More events deleted than destroyed" );
+ yuiError() << "FATAL: More events deleted than destroyed" << endl;
abort();
}
}
Modified: trunk/core/libyui/src/YMacroPlayer.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YMacroPlayer.cc?rev=43742&r1=43741&r2=43742&view=diff
==============================================================================
--- trunk/core/libyui/src/YMacroPlayer.cc (original)
+++ trunk/core/libyui/src/YMacroPlayer.cc Fri Jan 18 16:16:01 2008
@@ -24,8 +24,8 @@
#include
#include
-#define y2log_component "ui-macro"
-#include
+#define YUILogComponent "ui-macro"
+#include "YUILog.h"
#include "YUISymbols.h"
#include "YWidget.h"
@@ -43,7 +43,7 @@
YMacroPlayer::~YMacroPlayer()
{
- y2debug( "Deleting macro player." );
+ yuiDebug() << "Deleting macro player." << endl;
}
@@ -56,11 +56,11 @@
if ( ! macroFile )
{
setError();
- y2error( "Can't open macro file %s", macroFileName.c_str() );
+ yuiError() << "Can't open macro file " << macroFileName << endl;
return ;
}
- y2milestone( "Loading macro file %s", macroFileName.c_str() );
+ yuiMilestone() << "Loading macro file " << macroFileName << endl;
Parser parser( macroFile, macroFileName.c_str() );
YCodePtr parsed = parser.parse();
@@ -68,23 +68,26 @@
if ( !parsed || parsed->isError() )
{
setError();
- y2error( "Error parsing macro file %s - macro execution aborted",
- macroFileName.c_str() );
+ yuiError() << "Error parsing macro file " << macroFileName
+ << " -- macro execution aborted"
+ << endl;
return;
}
if ( !parsed->isBlock() )
{
setError();
- y2error( "Macro syntax error in file %s - expected YCP block",
- macroFileName.c_str() );
+ yuiError() << "Macro syntax error in file " << macroFileName
+ << " -- expected YCP block"
+ << endl;
return;
}
_macro = static_cast <YBlockPtr> (parsed) ;
- y2debug( "Playing macro from file %s - %d macro blocks",
- macroFileName.c_str(), _macro->statementCount() );
+ yuiDebug() << "Playing macro from file " << macroFileName
+ << " - " << _macro->statementCount() << " macro blocks"
+ << endl;
_nextBlockNo = 0;
fclose( macroFile );
@@ -95,12 +98,13 @@
{
if ( error() || !_macro || _nextBlockNo < 0 )
{
- y2warning( "Test for error() first before testing finished() !" );
+ yuiWarning() << "Test for error() first before testing finished() !" << endl;
return true;
}
- y2debug( "_nextBlockNo: %d, size: %d, finished(): %s",
- _nextBlockNo ,_macro->statementCount(),
- _nextBlockNo >= _macro->statementCount() ? "true" : "false" );
+ yuiDebug() << "_nextBlockNo: " << _nextBlockNo
+ << ", size: " << _macro->statementCount()
+ << ", finished(): " << boolalpha << ( _nextBlockNo >= _macro->statementCount() )
+ << endl;
return _nextBlockNo >= _macro->statementCount();
}
@@ -113,7 +117,7 @@
return YCPNull();
}
- y2milestone( "Evaluating macro block #%d", _nextBlockNo );
+ yuiMilestone() << "Evaluating macro block #" << _nextBlockNo << endl;
return _macro->evaluate( _nextBlockNo++ );
}
Modified: trunk/core/libyui/src/YMacroPlayer.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YMacroPlayer.h?rev=43742&r1=43741&r2=43742&view=diff
==============================================================================
--- trunk/core/libyui/src/YMacroPlayer.h (original)
+++ trunk/core/libyui/src/YMacroPlayer.h Fri Jan 18 16:16:01 2008
@@ -20,9 +20,9 @@
#define YMacroPlayer_h
#include <string>
+#include
class YWidget;
-class YBlock;
class YMacroPlayer
{
Modified: trunk/core/libyui/src/YMacroRecorder.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YMacroRecorder.cc?rev=43742&r1=43741&r2=43742&view=diff
==============================================================================
--- trunk/core/libyui/src/YMacroRecorder.cc (original)
+++ trunk/core/libyui/src/YMacroRecorder.cc Fri Jan 18 16:16:01 2008
@@ -23,11 +23,11 @@
#include
#include
#include
-
-#define y2log_component "ui-macro"
-#include
#include
+#define YUILogComponent "ui-macro"
+#include "YUILog.h"
+
#include "YUISymbols.h"
#include "YWidget.h"
#include "YInputField.h"
@@ -36,6 +36,7 @@
#include "YUIComponent.h"
#include "YCPValueWidgetID.h"
#include "YUI.h"
+#include "YUI_util.h"
#ifndef Y2LOG_DATE
# define Y2LOG_DATE "%Y-%m-%d %H:%M:%S" /* The date format */
@@ -67,12 +68,12 @@
if ( _macroFile )
{
- y2milestone( "Recording macro to %s", macroFileName.c_str() );
+ yuiMilestone() << "Recording macro to " << macroFileName << endl;
}
else
{
- y2error( "Can't record to macro file %s", macroFileName.c_str() );
+ yuiError() << "Can't record to macro file " << macroFileName << endl;
}
}
@@ -83,7 +84,7 @@
{
fclose( _macroFile );
_macroFile = 0;
- y2milestone( "Macro recording done." );
+ yuiMilestone() << "Macro recording done." << endl;
}
}
@@ -223,7 +224,7 @@
fflush( _macroFile ); // sync to disk at this point - for debugging
- y2debug( "Input: %s", input->isVoid() ? "(nil)" : input->toString().c_str() );
+ yuiDebug() << "Input: " << input << endl;
}
@@ -272,19 +273,19 @@
if ( ! widget )
{
- y2error( "Null widget" );
+ yuiError() << "Null widget" << endl;
return;
}
if ( ! widget->isValid() )
{
- y2error( "Invalid widget" );
+ yuiError() << "Invalid widget" << endl;
return;
}
if ( ! propertyName )
{
- y2error ( "Null property name" );
+ yuiError() << "Null property name" << endl;
return;
}
@@ -334,8 +335,10 @@
widget->widgetClass(),
widget->debugLabel().c_str() );
- y2debug( "Recording %s status: %s: %s",
- widget->widgetClass(), propertyName, val->toString().c_str() );
+ yuiDebug() << "Recording " << widget->widgetClass()
+ << " status: " << propertyName
+ << ": " << val
+ << endl;
}
}
Modified: trunk/core/libyui/src/YSimpleEventHandler.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YSimpleEventHandler.cc?rev=43742&r1=43741&r2=43742&view=diff
==============================================================================
--- trunk/core/libyui/src/YSimpleEventHandler.cc (original)
+++ trunk/core/libyui/src/YSimpleEventHandler.cc Fri Jan 18 16:16:01 2008
@@ -18,8 +18,8 @@
-#define y2log_component "ui-events"
-#include
+#define YUILogComponent "ui-events"
+#include "YUILog.h"
#include "YEvent.h"
#include "YSimpleEventHandler.h"
@@ -49,7 +49,7 @@
if ( _pending_event )
{
#if VERBOSE_EVENTS
- y2debug( "Clearing pending event: %s", YEvent::toString( _pending_event->eventType() ) );
+ yuiDebug() << "Clearing pending event: " << YEvent::toString( _pending_event->eventType() ) << endl;
#endif
delete _pending_event;
}
@@ -69,14 +69,14 @@
{
if ( ! event )
{
- y2error( "Ignoring NULL event" );
+ yuiError() << "Ignoring NULL event" << endl;
return;
}
if ( eventsBlocked() )
{
#if VERBOSE_BLOCK
- y2debug( "Blocking %s event", YEvent::toString( event->eventType() ) );
+ yuiDebug() << "Blocking " << YEvent::toString( event->eventType() ) << " event" << endl;
#endif
// Avoid memory leak: The event handler assumes ownership of the newly
// created event, so we have to clean it up here.
@@ -101,7 +101,7 @@
}
#if VERBOSE_EVENTS
- y2debug( "New pending event: %s", YEvent::toString( event->eventType() ) );
+ yuiDebug() << "New pending event: " << YEvent::toString( event->eventType() ) << endl;
#endif
_pending_event = event;
@@ -123,8 +123,8 @@
void YSimpleEventHandler::blockEvents( bool block )
{
#if VERBOSE_BLOCK
- if ( block ) y2debug( "Blocking events" );
- else y2debug( "Unblocking events" );
+ if ( block ) yuiDebug() << "Blocking events" << endl;
+ else yuiDebug() << "Unblocking events" << endl;
#endif
_events_blocked = block;
Modified: trunk/core/libyui/src/YUIPlugin.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUIPlugin.cc?rev=43742&r1=43741&r2=43742&view=diff
==============================================================================
--- trunk/core/libyui/src/YUIPlugin.cc (original)
+++ trunk/core/libyui/src/YUIPlugin.cc Fri Jan 18 16:16:01 2008
@@ -19,8 +19,8 @@
#include
-#define y2log_component "ui"
-#include
+#define YUILogComponent "ui"
+#include "YUILog.h"
#include "YUIPlugin.h"
@@ -43,8 +43,10 @@
if ( ! _pluginLibHandle )
{
_errorMsg = dlerror();
- y2error( "Could not load UI plugin \"%s\": %s",
- pluginLibBaseName, _errorMsg.c_str() );
+
+ yuiError() << "Could not load UI plugin \"" << pluginLibBaseName
+ << "\": " << _errorMsg
+ << endl;
}
}
@@ -79,8 +81,9 @@
if ( ! addr )
{
- y2error( "Could not locate symbol \"%s\" in %s",
- symbol, pluginLibFullPath().c_str() );
+ yuiError() << "Could not locate symbol \"" << symbol
+ << "\" in " << pluginLibFullPath()
+ << endl;
}
return addr;
Modified: trunk/core/libyui/src/YUI_builtins.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUI_builtins.cc?rev=43742&r1=43741&r2=43742&view=diff
==============================================================================
--- trunk/core/libyui/src/YUI_builtins.cc (original)
+++ trunk/core/libyui/src/YUI_builtins.cc Fri Jan 18 16:16:01 2008
@@ -35,11 +35,16 @@
#include
#define y2log_component "ui"
-#include
+#include // ycperror()
+
+#define YUILogComponent "ui"
+#include "YUILog.h"
+
#include
#include
#include "YUI.h"
+#include "YUI_util.h"
#include "YApplication.h"
#include "YEvent.h"
#include "YUIException.h"
@@ -101,7 +106,7 @@
else if ( symbol == YUISpecialWidget_TimezoneSelector ) hasWidget = fact->hasTimezoneSelector();
else
{
- y2error( "HasSpecialWidget(): Unknown special widget: %s", symbol.c_str() );
+ yuiError() << "HasSpecialWidget(): Unknown special widget: " << symbol << endl;
return YCPNull();
}
@@ -281,7 +286,7 @@
int YUI::runInTerminal ( const YCPString & module )
{
- y2error("Not in text-mode: Cannot run external program in terminal.");
+ yuiError() << "Not in text mode: Cannot run external program in terminal." << endl;
return -1;
}
@@ -415,9 +420,9 @@
YCPValue YUI::evaluateUserInput()
{
#if VERBOSE_EVENTS
- y2debug( "UI::UserInput()" );
+ yuiDebug() << "UI::UserInput()" << endl;
#endif
-
+
return doUserInput( YUIBuiltin_UserInput,
0, // timeout_millisec
true, // wait
@@ -443,9 +448,9 @@
YCPValue YUI::evaluatePollInput()
{
#if VERBOSE_EVENTS
- y2debug( "UI::PollInput()" );
+ yuiDebug() << "UI::PollInput()" << endl;
#endif
-
+
return doUserInput( YUIBuiltin_PollInput,
0, // timeout_millisec
false, // wait
@@ -471,9 +476,9 @@
YCPValue YUI::evaluateTimeoutUserInput( const YCPInteger & timeout )
{
long timeout_millisec = timeout->value();
-
+
#if VERBOSE_EVENTS
- y2debug( "UI::TimeoutUserInput( %d )", timeout_millisec );
+ yuiDebug() << "UI::TimeoutUserInput( " << timeout_millisec << " )" << endl;
#endif
return doUserInput( YUIBuiltin_TimeoutUserInput,
@@ -496,14 +501,14 @@
YCPValue YUI::evaluateWaitForEvent( const YCPInteger & timeout )
{
long timeout_millisec = 0;
-
+
if ( ! timeout.isNull() )
{
timeout_millisec = timeout->value();
}
-
+
#if VERBOSE_EVENTS
- y2debug( "UI::WaitForEvent( %d )", timeout_millisec );
+ yuiDebug() << "UI::WaitForEvent( " << timeout_millisec << " )" << endl;
#endif
return doUserInput( YUIBuiltin_WaitForEvent,
@@ -524,8 +529,10 @@
if ( timeout_millisec < 0 )
{
- y2error( "%s(): Invalid value %ld for timeout - assuming 0",
- builtin_name, timeout_millisec );
+ yuiError() << builtin_name << "(): Invalid value " << timeout_millisec
+ << " for timeout - assuming 0"
+ << endl;
+
timeout_millisec = 0;
}
@@ -536,7 +543,10 @@
if ( dialog->shortcutCheckPostponed() )
{
- y2error( "Missing CheckShortcuts() before %s() after PostponeShortcutCheck()!", builtin_name );
+ yuiError() << "Missing CheckShortcuts() before " << builtin_name
+ << "() after PostponeShortcutCheck()!"
+ << endl;
+
dialog->checkShortcuts( true );
}
@@ -555,7 +565,7 @@
// Get an event from the specific UI. Wait if there is none.
#if VERBOSE_EVENTS
- y2debug( "SpecificUI::userInput()" );
+ yuiDebug() << "SpecificUI::userInput()" << endl;
#endif
event = filterInvalidEvents( userInput( (unsigned long) timeout_millisec ) );
@@ -568,7 +578,7 @@
// Get an event from the specific UI. Don't wait if there is none.
#if VERBOSE_EVENTS
- y2debug( "SpecificUI::pollInput()" );
+ yuiDebug() << "SpecificUI::pollInput()" << endl;
#endif
event = filterInvalidEvents( pollInput() );
@@ -580,14 +590,14 @@
if ( event )
{
-
+
if ( detailed )
input = event->ycpEvent(); // The event map
else
input = event->userInput(); // Only one single ID (or 'nil')
#if VERBOSE_EVENTS
- y2debug( "Got regular event from keyboard / mouse: %s", input->toString().c_str() );
+ yuiDebug() << "Got regular event from keyboard / mouse: " << input << endl;
#endif
}
}
@@ -596,7 +606,7 @@
// Handle macro playing
input = fakeUserInputQueue.front();
- y2debug( "Using event from fakeUserInputQueue: %s", input->toString().c_str() );
+ yuiDebug() << "Using event from fakeUserInputQueue: "<< input << endl;
fakeUserInputQueue.pop_front();
}
@@ -648,7 +658,7 @@
* and the widget has been destroyed meanwhile.
**/
- // y2debug( "Discarding event for widget that has become invalid" );
+ // yuiDebug() << "Discarding event for widget that has become invalid" << endl;
delete widgetEvent;
return 0;
@@ -665,21 +675,21 @@
* arrived, but maybe simply nobody has evaluated them.
**/
- // Yes, really y2debug() - this may legitimately happen.
- y2debug( "Discarding event from widget from foreign dialog" );
+ // Yes, really yuiDebug() - this may legitimately happen.
+ yuiDebug() << "Discarding event from widget from foreign dialog" << endl;
#if VERBOSE_DISCARDED_EVENTS
- y2debug( "Expected: %p (widgetRep %p), received: %p (widgetRep %p)",
- YDialog::currentDialog(),
- YDialog::currentDialog()->widgetRep(),
- widgetEvent->widget()->findDialog(),
- widgetEvent->widget()->findDialog()->widgetRep() );
- y2debug( "Event widget: " );
+ yuiDebug() << "Expected: " << YDialog::currentDialog()
+ << ", received: " << widgetEvent->widget()->findDialog()
+ << endl;
+
+ yuiDebug() << "Event widget: " << widgetEvent->widget() << endl;
+ yuiDebug() << "From:" << endl;
widgetEvent->widget()->findDialog()->dumpWidgetTree();
- y2debug( "Current dialog:" );
+ yuiDebug() << "Current dialog:" << endl;
YDialog::currentDialog()->dumpWidgetTree();
#endif
-
+
delete widgetEvent;
return 0;
}
@@ -712,10 +722,10 @@
* distinct from the normal colors, but not as bright as warncolor.
*
* The <tt>`decorated</tt> option is now obsolete, but still accepted to keep
- * old code working.
+ * old code working.
*
* The <tt>`centered</tt> option is now obsolete, but still accepted to keep
- * old code working.
+ * old code working.
*
* @param term options
* @param term widget
@@ -728,7 +738,7 @@
{
YDialogType dialogType = YPopupDialog;
YDialogColorMode colorMode = YDialogNormalColor;
-
+
if ( ! opts.isNull() ) // evaluate `opt() contents
{
YCPList optList = opts->args();
@@ -744,7 +754,7 @@
else if ( optList->value(o)->asSymbol()->symbol() == YUIOpt_decorated ) {} // obsolete
else if ( optList->value(o)->asSymbol()->symbol() == YUIOpt_centered ) {} // obsolete
else
- y2warning( "Unknown option %s for OpenDialog", opts->value(o)->toString().c_str() );
+ yuiWarning() << "Unknown option " << opts->value(o) << " for OpenDialog" << endl;
}
}
}
@@ -752,7 +762,7 @@
blockEvents(); // Prevent self-generated events from UI built-ins.
bool ok = true;
-
+
try
{
YDialog * dialog = YUI::widgetFactory()->createDialog( dialogType, colorMode );
@@ -777,7 +787,7 @@
}
unblockEvents();
-
+
return YCPBoolean( ok );
}
@@ -839,11 +849,11 @@
YCPValue YUI::evaluateChangeWidget( const YCPValue & idValue, const YCPValue & property, const YCPValue & newValue )
{
YCPValue ret = YCPVoid();
-
+
try
{
blockEvents(); // We don't want self-generated events from UI::ChangeWidget().
-
+
if ( ! YCPDialogParser::isSymbolOrId( idValue ) )
{
YUI_THROW( YUISyntaxErrorException( string( "Expected `id(...) or `symbol, not " ) +
@@ -860,7 +870,6 @@
{
string oldShortcutString = widget->shortcutString();
string propertyName = property->asSymbol()->symbol();
- // y2milestone( "New style UI::ChangeWidget() for %s::%s", widget->widgetClass(), propertyName.c_str() );
YPropertyValue val;
@@ -930,7 +939,7 @@
YCPValue YUI::evaluateQueryWidget( const YCPValue & idValue, const YCPValue & property )
{
YCPValue ret = YCPVoid();
-
+
try
{
if ( ! YCPDialogParser::isSymbolOrId( idValue ) )
@@ -1002,7 +1011,7 @@
YCPBoolean YUI::evaluateReplaceWidget( const YCPValue & idValue, const YCPTerm & newContentTerm )
{
bool success = true;
-
+
try
{
if ( ! YCPDialogParser::isSymbolOrId( idValue ) )
@@ -1044,11 +1053,11 @@
{
YUI_CAUGHT( exception );
success = false;
-
+
ycperror( "UI::ReplaceWidget() failed: UI::ReplaceWidget( %s, %s )",
idValue->toString().c_str(),
newContentTerm->toString().c_str() );
-
+
}
unblockEvents();
@@ -1063,7 +1072,7 @@
* @short Runs a wizard command
* @description
* Issues a command to a wizard widget with ID 'wizardId'.
- *
+ *
* <b>This builtin is not for general use. Use the Wizard.ycp module instead.</b>
*
* For available wizard commands see file YWizard.cc .
@@ -1325,7 +1334,7 @@
{
if ( ! macroPlayer )
{
- y2error( "No macro player active." );
+ yuiError() << "No macro player active." << endl;
return;
}
@@ -1341,7 +1350,7 @@
if ( macroPlayer->error() || result.isNull() )
{
- y2error( "Macro aborted" );
+ yuiError() << "Macro aborted" << endl;
deleteMacroPlayer();
}
}
@@ -1375,7 +1384,7 @@
*/
void YUI::evaluateFakeUserInput( const YCPValue & next_input )
{
- y2debug( "UI::FakeUserInput(%s)", next_input->toString().c_str() );
+ yuiDebug() << "UI::FakeUserInput( " << next_input << " )" << endl;
fakeUserInputQueue.push_back( next_input );
}
@@ -1421,7 +1430,7 @@
else if ( sym == YUIGlyph_BulletSquare ) glyphText = YCPString( "[]" );
else // unknown glyph symbol
{
- y2error( "Unknown glyph `%s", sym.c_str() );
+ yuiError() << "Unknown glyph `" << sym << endl;
return YCPNull();
}
}
@@ -1596,7 +1605,7 @@
if ( ! dialog->shortcutCheckPostponed() )
{
- y2warning( "Use UI::CheckShortcuts() only after UI::PostponeShortcutCheck() !" );
+ yuiWarning() << "Use UI::CheckShortcuts() only after UI::PostponeShortcutCheck() !" << endl;
}
dialog->checkShortcuts( true );
@@ -1647,7 +1656,7 @@
{
if ( ! YCPDialogParser::isSymbolOrId( value_id ) )
{
- y2error( "RunPkgSelection(): expecting `id( ... ), not '%s'", value_id->toString().c_str() );
+ yuiError() << "RunPkgSelection(): expecting `id( ... ), not " << value_id << endl;
return YCPNull();
}
@@ -1685,7 +1694,7 @@
YUI::evaluateAskForExistingDirectory( const YCPString & startDir, const YCPString & headline )
{
string ret = app()->askForExistingDirectory( startDir->value(), headline->value() );
-
+
if ( ret.empty() )
return YCPVoid();
else
@@ -1710,7 +1719,7 @@
YCPValue YUI::evaluateAskForExistingFile( const YCPString & startWith, const YCPString & filter, const YCPString & headline )
{
string ret = app()->askForExistingFile( startWith->value(), filter->value(), headline->value() );
-
+
if ( ret.empty() )
return YCPVoid();
else
@@ -1735,7 +1744,7 @@
YCPValue YUI::evaluateAskForSaveFileName( const YCPString & startWith, const YCPString & filter, const YCPString & headline )
{
string ret = app()->askForSaveFileName( startWith->value(), filter->value(), headline->value() );
-
+
if ( ret.empty() )
return YCPVoid();
else
@@ -1769,7 +1778,7 @@
if ( fkey > 0 && fkey <= 24 )
{
- y2debug( "Mapping \"%s\"\t-> F%d", label.c_str(), fkey );
+ yuiDebug() << "Mapping \"" << label << "\"\t-> F" << fkey << endl;
app()->setDefaultFunctionKey( label, fkey );
}
else
@@ -1876,7 +1885,7 @@
static bool warned_about_recode = false;
if ( ! warned_about_recode )
{
- y2error ( "Recode ( %s, %s, ... )", from->value().c_str(), to->value().c_str() );
+ yuiError() << "Recode( " << from << ", " << to << " )" << endl;
warned_about_recode = true;
}
// return text as-is
Modified: trunk/core/libyui/src/YUI_core.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUI_core.cc?rev=43742&r1=43741&r2=43742&view=diff
==============================================================================
--- trunk/core/libyui/src/YUI_core.cc (original)
+++ trunk/core/libyui/src/YUI_core.cc Fri Jan 18 16:16:01 2008
@@ -23,17 +23,18 @@
#define VERBOSE_COMM 0 // VERY verbose thread communication logging
#include
-#include // pipe()
-#include // fcntl()
+#include // strerror()
+#include // pipe()
+#include // fcntl()
#include
-#include // setlocale()
+#include // setlocale()
#include
#define YUILogComponent "ui"
#include "YUILog.h"
-#define y2log_component "ui"
-#include
+#define YUILogComponent "ui"
+#include "YUILog.h"
#include
#include "Y2UINamespace.h"
@@ -86,13 +87,13 @@
{
if ( _withThreads && _uiThread )
{
- y2error( "shutdownThreads() was never called!" );
- y2error( "shutting down now - this might segfault" );
+ yuiError() << "shutdownThreads() was never called!" << endl;
+ yuiError() << "shutting down now - this might segfault" << endl;
shutdownThreads();
}
if ( YDialog::openDialogsCount() > 0 )
- y2error( "%d open dialogs left over", YDialog::openDialogsCount() );
+ yuiError() << YDialog::openDialogsCount() << " open dialogs left over" << endl;
YDialog::deleteAllDialogs();
@@ -179,7 +180,7 @@
arg = fcntl( pipe_to_ui[0], F_GETFL );
if ( fcntl( pipe_to_ui[0], F_SETFL, arg | O_NONBLOCK ) < 0 )
{
- y2error( "Couldn't set O_NONBLOCK: errno=%d: %m", errno );
+ yuiError() << "Couldn't set O_NONBLOCK: errno: " << errno << " " << strerror( errno ) << endl;
_withThreads = false;
close( pipe_to_ui[0] );
close( pipe_to_ui[1] );
@@ -194,13 +195,13 @@
}
else
{
- y2error( "pipe() failed: errno=%d: %m", errno );
+ yuiError() << "pipe() failed: errno: " << errno << " " << strerror( errno ) << endl;
exit(2);
}
}
else
{
- y2milestone( "Running without threads" );
+ yuiMilestone() << "Running without threads" << endl;
}
}
@@ -215,13 +216,13 @@
void YUI::terminateUIThread()
{
- y2debug( "Telling UI thread to shut down" );
+ yuiDebug() << "Telling UI thread to shut down" << endl;
terminate_ui_thread = true;
signalUIThread();
- y2debug( "Waiting for UI thread to shut down" );
+ yuiDebug() << "Waiting for UI thread to shut down" << endl;
waitForUIThread();
pthread_join( _uiThread, 0 );
- y2debug( "UI thread shut down correctly" );
+ yuiDebug() << "UI thread shut down correctly" << endl;
}
@@ -249,7 +250,7 @@
{
if ( function == 0 )
{
- y2error( "NULL function pointer!" );
+ yuiError() << "NULL function pointer!" << endl;
return YCPNull();
}
@@ -286,7 +287,7 @@
break;
default:
{
- y2error( "Bad builtin: Arg count %d", argc );
+ yuiError() << "Bad builtin: Arg count: " << argc << endl;
ret = YCPNull();
}
break;
@@ -302,7 +303,7 @@
(void) write ( pipe_to_ui[1], & arbitrary, 1 );
#if VERBOSE_COMM
- y2debug( "Wrote byte to ui thread %d", pipe_to_ui[1] );
+ yuiDebug() << "Wrote byte to UI thread: " << pipe_to_ui[1] << endl;
#endif
}
@@ -314,7 +315,7 @@
do {
#if VERBOSE_COMM
- y2debug ( "Waiting for ui thread..." );
+ yuiDebug() << "Waiting for UI thread..." << endl;
#endif
res = read( pipe_from_ui[0], & arbitrary, 1 );
if ( res == -1 )
@@ -322,12 +323,12 @@
if ( errno == EINTR || errno == EAGAIN )
continue;
else
- y2error ( "waitForUIThread: %m" );
+ yuiError() << "waitForUIThread: errno: " << errno << " " << strerror( errno ) << endl;
}
} while ( res == 0 );
#if VERBOSE_COMM
- y2debug ( "Read byte from ui thread" );
+ yuiDebug() << "Read byte from UI thread" << endl;
#endif
// return true if we really did get a signal byte
@@ -341,7 +342,7 @@
(void) write( pipe_from_ui[1], & arbitrary, 1 );
#if VERBOSE_COMM
- y2debug( "Wrote byte to ycp thread %d", pipe_from_ui[1] );
+ yuiDebug() << "Wrote byte to YCP thread: " << pipe_from_ui[1] << endl;
#endif
}
@@ -353,7 +354,7 @@
int res;
do {
#if VERBOSE_COMM
- y2debug ( "Waiting for ycp thread..." );
+ yuiDebug() << "Waiting for YCP thread..." << endl;
#endif
res = read( pipe_to_ui[0], & arbitrary, 1 );
if ( res == -1 )
@@ -361,12 +362,12 @@
if ( errno == EINTR || errno == EAGAIN )
continue;
else
- y2error ( "waitForYCPThread: errno=%d: %m", errno );
+ yuiError() << "waitForYCPThread: errno: " << errno << " " << strerror( errno ) << endl;
}
} while ( res == 0 );
#if VERBOSE_COMM
- y2debug ( "Read byte from ycp thread" );
+ yuiDebug() << "Read byte from YCP thread" << endl;
#endif
// return true if we really did get a signal byte
@@ -391,9 +392,9 @@
if ( terminate_ui_thread )
{
- y2debug( "Final sync with YCP thread" );
+ yuiDebug() << "Final sync with YCP thread" << endl;
signalYCPThread();
- y2debug( "Shutting down UI main loop" );
+ yuiDebug() << "Shutting down UI main loop" << endl;
return;
}
@@ -430,7 +431,7 @@
YUI * ui= (YUI *) yui;
#if VERBOSE_COMM
- y2debug( "Starting UI thread" );
+ yuiDebug() << "Starting UI thread" << endl;
#endif
if ( ui )
Modified: trunk/core/libyui/src/YUI_util.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUI_util.cc?rev=43742&r1=43741&r2=43742&view=diff
==============================================================================
--- trunk/core/libyui/src/YUI_util.cc (original)
+++ trunk/core/libyui/src/YUI_util.cc Fri Jan 18 16:16:01 2008
@@ -20,12 +20,12 @@
#include // strerror()
#include
+#define YUILogComponent "ui"
+#include "YUILog.h"
+
#include "YUI_util.h"
#include "YUI.h"
-#define y2log_component "ui"
-#include
-
using std::string;
@@ -47,13 +47,23 @@
if ( val->isFloat() )
return val->asFloat()->value();
- y2error( "Can't convert this to float: %s",
- val->toString().c_str() );
+ yuiError() << "Can't convert " << val << " to float" << endl;
return -1.0;
}
+std::ostream &
+operator<<( std::ostream & stream, const YCPValue & val )
+{
+ if ( val.isNull() )
+ return stream << "<YCPNull>";
+ else if ( val->isVoid() )
+ return stream << "<nil>";
+ else
+ return stream << val->toString();
+}
+
// FIXME: The following code is ugly
// FIXME: The following code is ugly
@@ -138,7 +148,11 @@
if ( ! complained )
{
// glibc-locale is not necessarily installed so only complain once
- y2error( "Recode: ( errno %d ) failed conversion '%s' to '%s'", errno, srcEncoding.c_str(), destEncoding.c_str() );
+ yuiError() << "Recode: (errno " << errno
+ << ") -- failed conversion: '" << srcEncoding
+ << "' --> '" << destEncoding << "'"
+ << endl;
+
complained = true;
}
dest = src;
Modified: trunk/core/libyui/src/YUI_util.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUI_util.h?rev=43742&r1=43741&r2=43742&view=diff
==============================================================================
--- trunk/core/libyui/src/YUI_util.h (original)
+++ trunk/core/libyui/src/YUI_util.h Fri Jan 18 16:16:01 2008
@@ -19,6 +19,8 @@
#ifndef YUI_util_h
#define YUI_util_h
+#include <iostream>
+
#include
#include
#include
@@ -38,7 +40,10 @@
**/
float toFloat( const YCPValue & val );
-
+/**
+ * Stream output for YCPValues
+ **/
+std::ostream & operator<<( std::ostream & stream, const YCPValue & val );
#endif // YUI_util_h
Modified: trunk/core/libyui/src/YWidget.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YWidget.cc?rev=43742&r1=43741&r2=43742&view=diff
==============================================================================
--- trunk/core/libyui/src/YWidget.cc (original)
+++ trunk/core/libyui/src/YWidget.cc Fri Jan 18 16:16:01 2008
@@ -589,7 +589,7 @@
child->setChildrenEnabled( enabled );
}
- // yuiDebug() << ( enabled ? "Enabling " : "Disabling " ) << child << endl;
+ // yuiDebug() << ( enabled ? "Enabling " : "Disabling " ) << child << endl;
child->setEnabled( enabled );
}
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org