Commit dc1fabfe authored by Pavel Vainerman's avatar Pavel Vainerman

(2.0): рефакторинг DebugStream. unideb --> ulog, добавлены новые функции…

(2.0): рефакторинг DebugStream. unideb --> ulog, добавлены новые функции (is_xxx(), level1(), info() )
parent d357e85b
......@@ -27,3 +27,5 @@ codegen:
Version 2.0
============
- написать документацию по ModbusSlave
- рефакторинг класса логов (DebugStream)
- циклическое хранилище для аварийных следов на основе SQLite
......@@ -448,7 +448,7 @@ int omap()
}
catch(Exception& ex)
{
unideb[Debug::CRIT] << " configuration init FAILED!!! \n";
ulog.crit() << " configuration init FAILED!!! \n";
return 1;
}
return 0;
......
......@@ -381,7 +381,7 @@ ModbusRTU::mbErrCode MBSlave::fileTransfer( ModbusRTU::FileTransferMessage& quer
int fd = open(fname.c_str(), O_RDONLY | O_NONBLOCK );
if( fd <= 0 )
{
dlog[Debug::WARN] << "(fileTransfer): open '" << fname << "' with error: " << strerror(errno) << endl;
dlog.warn() << "(fileTransfer): open '" << fname << "' with error: " << strerror(errno) << endl;
return ModbusRTU::erOperationFailed;
}
......@@ -393,7 +393,7 @@ ModbusRTU::mbErrCode MBSlave::fileTransfer( ModbusRTU::FileTransferMessage& quer
int ret = ::read(fd,&buf,sizeof(buf));
if( ret < 0 )
{
dlog[Debug::WARN] << "(fileTransfer): read from '" << fname << "' with error: " << strerror(errno) << endl;
dlog.warn() << "(fileTransfer): read from '" << fname << "' with error: " << strerror(errno) << endl;
close(fd);
return ModbusRTU::erOperationFailed;
}
......@@ -407,7 +407,7 @@ ModbusRTU::mbErrCode MBSlave::fileTransfer( ModbusRTU::FileTransferMessage& quer
struct stat fs;
if( fstat(fd,&fs) < 0 )
{
dlog[Debug::WARN] << "(fileTransfer): fstat for '" << fname << "' with error: " << strerror(errno) << endl;
dlog.warn() << "(fileTransfer): fstat for '" << fname << "' with error: " << strerror(errno) << endl;
close(fd);
return ModbusRTU::erOperationFailed;
}
......@@ -422,7 +422,7 @@ ModbusRTU::mbErrCode MBSlave::fileTransfer( ModbusRTU::FileTransferMessage& quer
if( !reply.set(query.numfile,numpacks,query.numpacket,buf,ret) )
{
dlog[Debug::WARN] << "(fileTransfer): set date failed..." << endl;
dlog.warn() << "(fileTransfer): set date failed..." << endl;
return ModbusRTU::erOperationFailed;
}
......
......@@ -376,7 +376,7 @@ ModbusRTU::mbErrCode MBTCPServer::fileTransfer( ModbusRTU::FileTransferMessage&
int fd = open(fname.c_str(), O_RDONLY | O_NONBLOCK );
if( fd <= 0 )
{
dlog[Debug::WARN] << "(fileTransfer): open '" << fname << "' with error: " << strerror(errno) << endl;
dlog.warn() << "(fileTransfer): open '" << fname << "' with error: " << strerror(errno) << endl;
return ModbusRTU::erOperationFailed;
}
......@@ -388,7 +388,7 @@ ModbusRTU::mbErrCode MBTCPServer::fileTransfer( ModbusRTU::FileTransferMessage&
int ret = ::read(fd,&buf,sizeof(buf));
if( ret < 0 )
{
dlog[Debug::WARN] << "(fileTransfer): read from '" << fname << "' with error: " << strerror(errno) << endl;
dlog.warn() << "(fileTransfer): read from '" << fname << "' with error: " << strerror(errno) << endl;
close(fd);
return ModbusRTU::erOperationFailed;
}
......@@ -402,7 +402,7 @@ ModbusRTU::mbErrCode MBTCPServer::fileTransfer( ModbusRTU::FileTransferMessage&
struct stat fs;
if( fstat(fd,&fs) < 0 )
{
dlog[Debug::WARN] << "(fileTransfer): fstat for '" << fname << "' with error: " << strerror(errno) << endl;
dlog.warn() << "(fileTransfer): fstat for '" << fname << "' with error: " << strerror(errno) << endl;
close(fd);
return ModbusRTU::erOperationFailed;
}
......@@ -417,7 +417,7 @@ ModbusRTU::mbErrCode MBTCPServer::fileTransfer( ModbusRTU::FileTransferMessage&
if( !reply.set(query.numfile,numpacks,query.numpacket,buf,ret) )
{
dlog[Debug::WARN] << "(fileTransfer): set date failed..." << endl;
dlog.warn() << "(fileTransfer): set date failed..." << endl;
return ModbusRTU::erOperationFailed;
}
......
......@@ -89,16 +89,19 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
}
catch( Exception&amp; ex )
{
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
}
catch(CORBA::SystemException&amp; ex)
{
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(execute): СORBA::SystemException: "
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(execute): СORBA::SystemException: "
&lt;&lt; ex.NP_minorString() &lt;&lt; endl;
}
catch(...)
{
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(execute): catch ..." &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(execute): catch ..." &lt;&lt; endl;
}
if( !active )
......@@ -143,8 +146,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
break;
}
if( !activated )
unideb[Debug::CRIT] &lt;&lt; myname
if( !activated &amp;&amp; ulog.is_crit() )
ulog.crit() &lt;&lt; myname
&lt;&lt; "(preAskSensors): ************* don`t activated?! ************" &lt;&lt; endl;
for( ;; )
......@@ -162,15 +165,18 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
}
catch(SystemError&amp; err)
{
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(preAskSensors): " &lt;&lt; err &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(preAskSensors): " &lt;&lt; err &lt;&lt; endl;
}
catch(Exception&amp; ex)
{
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(preAskSensors): " &lt;&lt; ex &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(preAskSensors): " &lt;&lt; ex &lt;&lt; endl;
}
catch(...)
{
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(preAskSensors): catch(...)" &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(preAskSensors): catch(...)" &lt;&lt; endl;
}
msleep(askPause);
}
......@@ -185,7 +191,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _si
<xsl:if test="normalize-space(@vartype)='out'">
if( _sid == <xsl:value-of select="../../@name"/> )
{
unideb[Debug::LEVEL2] &lt;&lt; "(setValue): <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = " &lt;&lt; _val &lt;&lt; endl;
if( ulog.is_level2() )
ulog.level2() &lt;&lt; "(setValue): <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = " &lt;&lt; _val &lt;&lt; endl;
<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = _val;
<xsl:call-template name="setdata"/>
return;
......@@ -217,16 +224,16 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si
</xsl:if>
</xsl:if>
</xsl:for-each>
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getValue): Обращение к неизвестному датчику sid="
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(getValue): Обращение к неизвестному датчику sid="
&lt;&lt; _sid &lt;&lt; endl;
return 0;
}
catch(Exception&amp; ex)
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getValue): " &lt;&lt; ex &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(getValue): " &lt;&lt; ex &lt;&lt; endl;
throw;
}
}
......@@ -292,8 +299,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
}
catch(Exception&amp; ex)
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
}
</xsl:template>
......@@ -328,8 +335,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
}
catch(Exception&amp; ex)
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
}
</xsl:template>
......@@ -344,8 +351,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
}
catch(Exception&amp; ex)
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
}
</xsl:template>
......
......@@ -94,16 +94,19 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
}
catch( Exception&amp; ex )
{
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
}
catch(CORBA::SystemException&amp; ex)
{
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(execute): СORBA::SystemException: "
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(execute): СORBA::SystemException: "
&lt;&lt; ex.NP_minorString() &lt;&lt; endl;
}
catch(...)
{
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(execute): catch ..." &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(execute): catch ..." &lt;&lt; endl;
}
if( !active )
......@@ -154,7 +157,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _si
<xsl:if test="normalize-space(@vartype)='out'">
if( _sid == <xsl:value-of select="../../@name"/> )
{
unideb[Debug::LEVEL2] &lt;&lt; "(setValue): <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = " &lt;&lt; _val &lt;&lt; endl;
if( ulog.is_level2() )
ulog.level2() &lt;&lt; "(setValue): <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = " &lt;&lt; _val &lt;&lt; endl;
<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = _val;
return;
}
......@@ -176,8 +180,8 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si
</xsl:if>
</xsl:for-each>
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getValue): Обращение к неизвестному датчику sid="
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(getValue): Обращение к неизвестному датчику sid="
&lt;&lt; _sid &lt;&lt; endl;
return 0;
......@@ -228,7 +232,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
}
catch( Exception&amp; ex )
{
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
}
</xsl:template>
......@@ -263,8 +268,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
}
catch( Exception&amp; ex )
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
}
</xsl:template>
......@@ -279,8 +284,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
}
catch( Exception&amp; ex )
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
}
......
......@@ -88,16 +88,19 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
}
catch( Exception&amp; ex )
{
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
}
catch(CORBA::SystemException&amp; ex)
{
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(execute): СORBA::SystemException: "
&lt;&lt; ex.NP_minorString() &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(execute): СORBA::SystemException: "
&lt;&lt; ex.NP_minorString() &lt;&lt; endl;
}
catch(...)
{
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(execute): catch ..." &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(execute): catch ..." &lt;&lt; endl;
}
if( !active )
......@@ -113,7 +116,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _si
<xsl:if test="normalize-space(@vartype)='out'">
if( _sid == <xsl:value-of select="@name"/> )
{
unideb[Debug::LEVEL2] &lt;&lt; "(setState): <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = " &lt;&lt; _val &lt;&lt; endl;
if( ulog.is_level2() )
ulog.level2() &lt;&lt; "(setState): <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = " &lt;&lt; _val &lt;&lt; endl;
<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = _val;
<xsl:call-template name="setdata"/>
return;
......@@ -184,14 +188,14 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si
return <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>;
}
</xsl:for-each>
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getValue): Обращение к неизвестному датчику sid="
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(getValue): Обращение к неизвестному датчику sid="
&lt;&lt; _sid &lt;&lt; endl;
}
catch(Exception&amp; ex)
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getValue): " &lt;&lt; ex &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(getValue): " &lt;&lt; ex &lt;&lt; endl;
throw;
}
......@@ -210,8 +214,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
break;
}
if( !activated )
unideb[Debug::CRIT] &lt;&lt; myname
if( !activated &amp;&amp; ulog.is_crit() )
ulog.crit() &lt;&lt; myname
&lt;&lt; "(preAskSensors): ************* don`t activated?! ************" &lt;&lt; endl;
for( ;; )
......@@ -228,15 +232,18 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
}
catch(SystemError&amp; err)
{
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(preAskSensors): " &lt;&lt; err &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(preAskSensors): " &lt;&lt; err &lt;&lt; endl;
}
catch(Exception&amp; ex)
{
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(preAskSensors): " &lt;&lt; ex &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(preAskSensors): " &lt;&lt; ex &lt;&lt; endl;
}
catch(...)
{
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(preAskSensors): catch(...)" &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(preAskSensors): catch(...)" &lt;&lt; endl;
}
msleep(askPause);
}
......@@ -268,8 +275,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
}
catch( UniSetTypes::Exception&amp; ex )
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
}
}
......@@ -286,8 +293,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
}
catch( UniSetTypes::Exception&amp; ex )
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
}
}
......@@ -305,8 +312,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
}
catch( UniSetTypes::Exception&amp; ex )
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
}
}
......
......@@ -93,16 +93,19 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
}
catch( Exception&amp; ex )
{
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
}
catch(CORBA::SystemException&amp; ex)
{
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(execute): СORBA::SystemException: "
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(execute): СORBA::SystemException: "
&lt;&lt; ex.NP_minorString() &lt;&lt; endl;
}
catch(...)
{
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(execute): catch ..." &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(execute): catch ..." &lt;&lt; endl;
}
if( !active )
......@@ -118,7 +121,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId sid
<xsl:if test="normalize-space(@vartype)='out'">
if( sid == <xsl:value-of select="@name"/> )
{
unideb[Debug::LEVEL2] &lt;&lt; "(setValue): <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = " &lt;&lt; val &lt;&lt; endl;
if( ulog.is_level2() )
ulog.level2() &lt;&lt; "(setValue): <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = " &lt;&lt; val &lt;&lt; endl;
<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = val;
return;
}
......@@ -174,7 +178,8 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si
return <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>;
</xsl:for-each>
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getValue): Обращение к неизвестному датчику sid="
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(getValue): Обращение к неизвестному датчику sid="
&lt;&lt; _sid &lt;&lt; endl;
return 0;
}
......@@ -209,8 +214,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId code,
}
catch( Exception&amp; ex )
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
}
</xsl:template>
......@@ -227,8 +232,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId code,
}
catch( Exception&amp; ex )
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
}
</xsl:template>
......@@ -246,8 +251,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId code,
}
catch( Exception&amp; ex )
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
}
</xsl:template>
......@@ -264,7 +269,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId code,
}
catch( Exception&amp; ex )
{
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setmsg): " &lt;&lt; ex &lt;&lt; endl;
if( ulog.is_crit() )
ulog.crit() &lt;&lt; myname &lt;&lt; "(setmsg): " &lt;&lt; ex &lt;&lt; endl;
throw;
}
</xsl:template>
......
......@@ -56,7 +56,7 @@ int main( int argc,char* argv[] )
string logfilename = conf->getArgParam("--logfile","<xsl:value-of select="$CLASSNAME"/>.log");
string logname( conf->getLogDir() + logfilename );
unideb.logFile( logname.c_str() );
ulog.logFile( logname.c_str() );
// определяем ID объекта
ObjectId ID(DefaultObjectId);
......
......@@ -58,7 +58,7 @@ int main( int argc, const char** argv )
string logfilename = conf->getArgParam("--logfile","<xsl:value-of select="$CLASSNAME"/>.log");
string logname( conf->getLogDir() + logfilename );
unideb.logFile( logname.c_str() );
ulog.logFile( logname.c_str() );
<xsl:if test="not(normalize-space(//@OID))=''">
<xsl:value-of select="$CLASSNAME"/> obj;
......
......@@ -14,14 +14,14 @@ int main( int argc, const char **argv )
string logfilename = conf->getArgParam("--logfile", "Skel.log");
string logname( conf->getLogDir() + logfilename );
// dlog.logFile( logname.c_str() );
unideb.logFile( logname.c_str() );
ulog.logFile( logname.c_str() );
// conf->initDebug(dlog,"dlog");
ObjectsActivator act;
xmlNode* cnode = conf->getNode("Skel");
if( cnode == NULL )
{
dlog[Debug::CRIT] << "(Skel): not found <Skel> in conffile" << endl;
dlog.crit() << "(Skel): not found <Skel> in conffile" << endl;
return 1;
}
......@@ -31,8 +31,8 @@ int main( int argc, const char **argv )
SystemMessage sm(SystemMessage::StartUp);
act.broadcast( sm.transport_msg() );
unideb(Debug::ANY) << "\n\n\n";
unideb[Debug::ANY] << "(Skel::main): -------------- Skel START -------------------------\n\n";
ulog.ebug::ANY) << "\n\n\n";
ulog.ebug::ANY] << "(Skel::main): -------------- Skel START -------------------------\n\n";
dlog(Debug::ANY) << "\n\n\n";
dlog[Debug::ANY] << "(Skel::main): -------------- Skel START -------------------------\n\n";
act.run(false);
......
......@@ -353,6 +353,8 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
- refactoring <depends> mechanism
- add iofront=[01,10] to IOBase
- remove deprecated interfaces (Storages,CycleStorage,TableStorage,TextIndex,..)
- rename unideb --> ulog
- DebugStream refactoring (add new function)
* Tue Dec 10 2013 Pavel Vainerman <pv@altlinux.ru> 1.7-alt3
- add RRDServer
......
......@@ -147,32 +147,32 @@ void DBServer_MySQL::parse( UniSetTypes::ConfirmMessage* cem )
<< " AND time='" << ui.timeToString(cem->time, ":") <<" '"
<< " AND time_usec='" << cem->time_usec <<" '";
if( unideb.debugging(DBLEVEL) )
unideb[DBLEVEL] << myname << "(update_confirm): " << data.str() << endl;
if( ulog.debugging(DBLEVEL) )
ulog[DBLEVEL] << myname << "(update_confirm): " << data.str() << endl;
if( !writeToBase(data.str()) )
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(update_confirm): db error: "<< db->error() << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(update_confirm): db error: "<< db->error() << endl;
db->freeResult();
}
}
catch( Exception& ex )
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(update_confirm): " << ex << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(update_confirm): " << ex << endl;
}
catch( ... )
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(update_confirm): catch..." << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(update_confirm): catch..." << endl;
}
}
//--------------------------------------------------------------------------------------------
bool DBServer_MySQL::writeToBase( const string& query )
{
if( unideb.debugging(DBLogInfoLevel) )
unideb[DBLogInfoLevel] << myname << "(writeToBase): " << query << endl;
if( ulog.debugging(DBLogInfoLevel) )
ulog[DBLogInfoLevel] << myname << "(writeToBase): " << query << endl;
// cout << "DBServer_MySQL: " << query << endl;
if( !db || !connect_ok )
{
......@@ -188,8 +188,8 @@ bool DBServer_MySQL::writeToBase( const string& query )
qbuf.pop();
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(writeToBase): DB not connected! buffer(" << qbufSize
if( ulog.is_crit() )
ulog.crit() << myname << "(writeToBase): DB not connected! buffer(" << qbufSize
<< ") overflow! lost query: " << qlost << endl;
}
return false;
......@@ -231,9 +231,9 @@ void DBServer_MySQL::flushBuffer()
string err(db->error());
if( err.empty() )
db->freeResult();
else if( unideb.debugging(Debug::CRIT) )
else if( ulog.is_crit() )
{
unideb[Debug::CRIT] << myname << "(writeToBase): error: " << err <<
ulog.crit() << myname << "(writeToBase): error: " << err <<
" lost query: " << qbuf.front() << endl;
}
......@@ -264,31 +264,33 @@ void DBServer_MySQL::parse( UniSetTypes::SensorMessage *si )
<< si->value << "," // value
<< si->node << ")"; // node
if( unideb.debugging(DBLEVEL) )
unideb[DBLEVEL] << myname << "(insert_main_history): " << data.str() << endl;
if( ulog.debugging(DBLEVEL) )
ulog[DBLEVEL] << myname << "(insert_main_history): " << data.str() << endl;
if( !writeToBase(data.str()) )
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(insert) sensor msg error: "<< db->error() << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(insert) sensor msg error: "<< db->error() << endl;
db->freeResult();
}
}
catch( Exception& ex )
{
unideb[Debug::CRIT] << myname << "(insert_main_history): " << ex << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(insert_main_history): " << ex << endl;
}
catch( ... )
{
unideb[Debug::CRIT] << myname << "(insert_main_history): catch ..." << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(insert_main_history): catch ..." << endl;
}
}
//--------------------------------------------------------------------------------------------
void DBServer_MySQL::init_dbserver()
{
DBServer::init_dbserver();
if( unideb.debugging(DBLogInfoLevel) )
unideb[DBLogInfoLevel] << myname << "(init): ..." << endl;
if( ulog.debugging(DBLogInfoLevel) )
ulog[DBLogInfoLevel] << myname << "(init): ..." << endl;
if( connect_ok )
{
......@@ -312,7 +314,7 @@ void DBServer_MySQL::init_dbserver()
UniXML::iterator it(node);
unideb[DBLogInfoLevel] << myname << "(init): init connection.." << endl;
ulog[DBLogInfoLevel] << myname << "(init): init connection.." << endl;
string dbname(conf->getProp(node,"dbname"));
string dbnode(conf->getProp(node,"dbnode"));
string user(conf->getProp(node,"dbuser"));
......@@ -335,8 +337,8 @@ void DBServer_MySQL::init_dbserver()
if( dbnode.empty() )
dbnode = "localhost";
if( unideb.debugging(DBLogInfoLevel) )
unideb[DBLogInfoLevel] << myname << "(init): connect dbnode=" << dbnode
if( ulog.debugging(DBLogInfoLevel) )
ulog[DBLogInfoLevel] << myname << "(init): connect dbnode=" << dbnode
<< "\tdbname=" << dbname
<< " pingTime=" << PingTime
<< " ReconnectTime=" << ReconnectTime << endl;
......@@ -344,8 +346,8 @@ void DBServer_MySQL::init_dbserver()
if( !db->connect(dbnode, user, password, dbname) )
{
// ostringstream err;
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname
if( ulog.is_crit() )
ulog.crit() << myname
<< "(init): DB connection error: "
<< db->error() << endl;
// throw Exception( string(myname+"(init): не смогли создать соединение с БД "+db->error()) );
......@@ -353,8 +355,8 @@ void DBServer_MySQL::init_dbserver()
}
else
{
if( unideb.debugging(DBLogInfoLevel) )
unideb[DBLogInfoLevel] << myname << "(init): connect [OK]" << endl;
if( ulog.debugging(DBLogInfoLevel) )
ulog[DBLogInfoLevel] << myname << "(init): connect [OK]" << endl;
connect_ok = true;
askTimer(DBServer_MySQL::ReconnectTimer,0);
askTimer(DBServer_MySQL::PingTimer,PingTime);
......@@ -370,8 +372,8 @@ void DBServer_MySQL::createTables( DBInterface *db )
UniXML_iterator it( conf->getNode("Tables") );
if(!it)
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << ": section <Tables> not found.."<< endl;
if( ulog.is_crit() )
ulog.crit() << myname << ": section <Tables> not found.."<< endl;
throw Exception();
}
......@@ -379,12 +381,12 @@ void DBServer_MySQL::createTables( DBInterface *db )
{
if( it.getName() != "comment" )
{
if( unideb.debugging(DBLogInfoLevel) )
unideb[DBLogInfoLevel] << myname << "(createTables): create " << it.getName() << endl;
if( ulog.debugging(DBLogInfoLevel) )
ulog[DBLogInfoLevel] << myname << "(createTables): create " << it.getName() << endl;
ostringstream query;
query << "CREATE TABLE " << conf->getProp(it,"name") << "(" << conf->getProp(it,"create") << ")";
if( !db->query(query.str()) && unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(createTables): error: \t\t" << db->error() << endl;
if( !db->query(query.str()) && ulog.is_crit() )
ulog.crit() << myname << "(createTables): error: \t\t" << db->error() << endl;
}
}
}
......@@ -397,8 +399,8 @@ void DBServer_MySQL::timerInfo( UniSetTypes::TimerMessage* tm )
{
if( !db->ping() )
{
if( unideb.debugging(Debug::WARN) )
unideb[Debug::WARN] << myname << "(timerInfo): DB lost connection.." << endl;
if( ulog.is_warn() )
ulog.warn() << myname << "(timerInfo): DB lost connection.." << endl;
connect_ok = false;
askTimer(DBServer_MySQL::PingTimer,0);
askTimer(DBServer_MySQL::ReconnectTimer,ReconnectTime);
......@@ -406,16 +408,16 @@ void DBServer_MySQL::timerInfo( UniSetTypes::TimerMessage* tm )
else
{
connect_ok = true;
if( unideb.debugging(DBLogInfoLevel) )
unideb[DBLogInfoLevel] << myname << "(timerInfo): DB ping ok" << endl;
if( ulog.debugging(DBLogInfoLevel) )
ulog[DBLogInfoLevel] << myname << "(timerInfo): DB ping ok" << endl;
}
}
break;
case DBServer_MySQL::ReconnectTimer:
{
if( unideb.debugging(DBLogInfoLevel) )
unideb[DBLogInfoLevel] << myname << "(timerInfo): reconnect timer" << endl;
if( ulog.debugging(DBLogInfoLevel) )
ulog[DBLogInfoLevel] << myname << "(timerInfo): reconnect timer" << endl;
if( db->isConnection() )
{
if( db->ping() )
......@@ -425,8 +427,8 @@ void DBServer_MySQL::timerInfo( UniSetTypes::TimerMessage* tm )
askTimer(DBServer_MySQL::PingTimer,PingTime);
}
connect_ok = false;
if( unideb.debugging(Debug::WARN) )
unideb[Debug::WARN] << myname << "(timerInfo): DB no connection.." << endl;
if( ulog.is_warn() )
ulog.warn() << myname << "(timerInfo): DB no connection.." << endl;
}
else
init_dbserver();
......@@ -434,8 +436,8 @@ void DBServer_MySQL::timerInfo( UniSetTypes::TimerMessage* tm )
break;
default:
if( unideb.debugging(Debug::WARN) )
unideb[Debug::WARN] << myname << "(timerInfo): Unknown TimerID=" << tm->id << endl;
if( ulog.is_warn() )
ulog.warn() << myname << "(timerInfo): Unknown TimerID=" << tm->id << endl;
break;
}
}
......
......@@ -31,7 +31,7 @@ int main(int argc, char** argv)
{
if( ID != UniSetTypes::DefaultObjectId )
{
unideb[Debug::WARN] << "(DBServer::main): переопределяем ID заданнй в "
ulog.warn() << "(DBServer::main): переопределяем ID заданнй в "
<< conf->getConfFileName() << endl;
}
......
......@@ -143,31 +143,31 @@ void DBServer_SQLite::parse( UniSetTypes::ConfirmMessage* cem )
<< " AND time='" << ui.timeToString(cem->time, ":") <<" '"
<< " AND time_usec='" << cem->time_usec <<" '";
if( unideb.debugging(DBLEVEL) )
unideb[DBLEVEL] << myname << "(update_confirm): " << data.str() << endl;
if( ulog.debugging(DBLEVEL) )
ulog[DBLEVEL] << myname << "(update_confirm): " << data.str() << endl;
if( !writeToBase(data.str()) )
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(update_confirm): db error: "<< db->error() << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(update_confirm): db error: "<< db->error() << endl;
}
}
catch( Exception& ex )
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(update_confirm): " << ex << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(update_confirm): " << ex << endl;
}
catch( ... )
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(update_confirm): catch..." << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(update_confirm): catch..." << endl;
}
}
//--------------------------------------------------------------------------------------------
bool DBServer_SQLite::writeToBase( const string& query )
{
if( unideb.debugging(DBLogInfoLevel) )
unideb[DBLogInfoLevel] << myname << "(writeToBase): " << query << endl;
if( ulog.debugging(DBLogInfoLevel) )
ulog[DBLogInfoLevel] << myname << "(writeToBase): " << query << endl;
// cout << "DBServer_SQLite: " << query << endl;
if( !db || !connect_ok )
{
......@@ -183,8 +183,8 @@ bool DBServer_SQLite::writeToBase( const string& query )
qbuf.pop();
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(writeToBase): DB not connected! buffer(" << qbufSize
if( ulog.is_crit() )
ulog.crit() << myname << "(writeToBase): DB not connected! buffer(" << qbufSize
<< ") overflow! lost query: " << qlost << endl;
}
return false;
......@@ -207,9 +207,9 @@ void DBServer_SQLite::flushBuffer()
// Сперва пробуем очистить всё что накопилось в очереди до этого...
while( !qbuf.empty() )
{
if( !db->insert(qbuf.front()) && unideb.debugging(Debug::CRIT) )
if( !db->insert(qbuf.front()) && ulog.is_crit() )
{
unideb[Debug::CRIT] << myname << "(writeToBase): error: " << db->error() <<
ulog.crit() << myname << "(writeToBase): error: " << db->error() <<
" lost query: " << qbuf.front() << endl;
}
qbuf.pop();
......@@ -239,30 +239,30 @@ void DBServer_SQLite::parse( UniSetTypes::SensorMessage *si )
<< si->value << "," // value
<< si->node << ")"; // node
if( unideb.debugging(DBLEVEL) )
unideb[DBLEVEL] << myname << "(insert_main_history): " << data.str() << endl;
if( ulog.debugging(DBLEVEL) )
ulog[DBLEVEL] << myname << "(insert_main_history): " << data.str() << endl;
if( !writeToBase(data.str()) )
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(insert) sensor msg error: "<< db->error() << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(insert) sensor msg error: "<< db->error() << endl;
}
}
catch( Exception& ex )
{
unideb[Debug::CRIT] << myname << "(insert_main_history): " << ex << endl;
ulog.crit() << myname << "(insert_main_history): " << ex << endl;
}
catch( ... )
{
unideb[Debug::CRIT] << myname << "(insert_main_history): catch ..." << endl;
ulog.crit() << myname << "(insert_main_history): catch ..." << endl;
}
}
//--------------------------------------------------------------------------------------------
void DBServer_SQLite::init_dbserver()
{
DBServer::init_dbserver();
if( unideb.debugging(DBLogInfoLevel) )
unideb[DBLogInfoLevel] << myname << "(init): ..." << endl;
if( ulog.debugging(DBLogInfoLevel) )
ulog[DBLogInfoLevel] << myname << "(init): ..." << endl;
if( connect_ok )
{
......@@ -286,7 +286,7 @@ void DBServer_SQLite::init_dbserver()
UniXML::iterator it(node);
unideb[DBLogInfoLevel] << myname << "(init): init connection.." << endl;
ulog[DBLogInfoLevel] << myname << "(init): init connection.." << endl;
string dbfile(conf->getProp(node,"dbfile"));
tblMap[UniSetTypes::Message::SensorInfo] = "main_history";
......@@ -302,17 +302,17 @@ void DBServer_SQLite::init_dbserver()
lastRemove = true;
else
lastRemove = false;
if( unideb.debugging(DBLogInfoLevel) )
unideb[DBLogInfoLevel] << myname << "(init): connect dbfile=" << dbfile
<< " pingTime=" << PingTime
if( ulog.debugging(DBLogInfoLevel) )
ulog[DBLogInfoLevel] << myname << "(init): connect dbfile=" << dbfile
<< " pingTime=" << PingTime
<< " ReconnectTime=" << ReconnectTime << endl;
if( !db->connect(dbfile,false) )
{
// ostringstream err;
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname
if( ulog.is_crit() )
ulog.crit() << myname
<< "(init): DB connection error: "
<< db->error() << endl;
// throw Exception( string(myname+"(init): не смогли создать соединение с БД "+db->error()) );
......@@ -320,8 +320,8 @@ void DBServer_SQLite::init_dbserver()
}
else
{
if( unideb.debugging(DBLogInfoLevel) )
unideb[DBLogInfoLevel] << myname << "(init): connect [OK]" << endl;
if( ulog.debugging(DBLogInfoLevel) )
ulog[DBLogInfoLevel] << myname << "(init): connect [OK]" << endl;
connect_ok = true;
askTimer(DBServer_SQLite::ReconnectTimer,0);
askTimer(DBServer_SQLite::PingTimer,PingTime);
......@@ -337,8 +337,8 @@ void DBServer_SQLite::createTables( SQLiteInterface *db )
UniXML_iterator it( conf->getNode("Tables") );
if(!it)
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << ": section <Tables> not found.."<< endl;
if( ulog.is_crit() )
ulog.crit() << myname << ": section <Tables> not found.."<< endl;
throw Exception();
}
......@@ -346,12 +346,12 @@ void DBServer_SQLite::createTables( SQLiteInterface *db )
{
if( it.getName() != "comment" )
{
if( unideb.debugging(DBLogInfoLevel) )
unideb[DBLogInfoLevel] << myname << "(createTables): create " << it.getName() << endl;
if( ulog.debugging(DBLogInfoLevel) )
ulog[DBLogInfoLevel] << myname << "(createTables): create " << it.getName() << endl;
ostringstream query;
query << "CREATE TABLE " << conf->getProp(it,"name") << "(" << conf->getProp(it,"create") << ")";
if( !db->query(query.str()) && unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(createTables): error: \t\t" << db->error() << endl;
if( !db->query(query.str()) && ulog.is_crit() )
ulog.crit() << myname << "(createTables): error: \t\t" << db->error() << endl;
}
}
}
......@@ -364,8 +364,8 @@ void DBServer_SQLite::timerInfo( UniSetTypes::TimerMessage* tm )
{
if( !db->ping() )
{
if( unideb.debugging(Debug::WARN) )
unideb[Debug::WARN] << myname << "(timerInfo): DB lost connection.." << endl;
if( ulog.is_warn() )
ulog.warn() << myname << "(timerInfo): DB lost connection.." << endl;
connect_ok = false;
askTimer(DBServer_SQLite::PingTimer,0);
askTimer(DBServer_SQLite::ReconnectTimer,ReconnectTime);
......@@ -373,16 +373,16 @@ void DBServer_SQLite::timerInfo( UniSetTypes::TimerMessage* tm )
else
{
connect_ok = true;
if( unideb.debugging(DBLogInfoLevel) )
unideb[DBLogInfoLevel] << myname << "(timerInfo): DB ping ok" << endl;
if( ulog.debugging(DBLogInfoLevel) )
ulog[DBLogInfoLevel] << myname << "(timerInfo): DB ping ok" << endl;
}
}
break;
case DBServer_SQLite::ReconnectTimer:
{
if( unideb.debugging(DBLogInfoLevel) )
unideb[DBLogInfoLevel] << myname << "(timerInfo): reconnect timer" << endl;
if( ulog.debugging(DBLogInfoLevel) )
ulog[DBLogInfoLevel] << myname << "(timerInfo): reconnect timer" << endl;
if( db->isConnection() )
{
if( db->ping() )
......@@ -392,8 +392,8 @@ void DBServer_SQLite::timerInfo( UniSetTypes::TimerMessage* tm )
askTimer(DBServer_SQLite::PingTimer,PingTime);
}
connect_ok = false;
if( unideb.debugging(Debug::WARN) )
unideb[Debug::WARN] << myname << "(timerInfo): DB no connection.." << endl;
if( ulog.is_warn() )
ulog.warn() << myname << "(timerInfo): DB no connection.." << endl;
}
else
init_dbserver();
......@@ -401,8 +401,8 @@ void DBServer_SQLite::timerInfo( UniSetTypes::TimerMessage* tm )
break;
default:
if( unideb.debugging(Debug::WARN) )
unideb[Debug::WARN] << myname << "(timerInfo): Unknown TimerID=" << tm->id << endl;
if( ulog.is_warn() )
ulog.warn() << myname << "(timerInfo): Unknown TimerID=" << tm->id << endl;
break;
}
}
......
......@@ -31,7 +31,7 @@ int main(int argc, char** argv)
{
if( ID != UniSetTypes::DefaultObjectId )
{
unideb[Debug::WARN] << "(DBServer::main): переопределяем ID заданнй в "
ulog.warn() << "(DBServer::main): переопределяем ID заданнй в "
<< conf->getConfFileName() << endl;
}
......
......@@ -28,7 +28,7 @@ int main(int argc, const char **argv)
string logfilename = conf->getArgParam("--io-logfile","iocontrol.log");
string logname( conf->getLogDir() + logfilename );
dlog.logFile( logname );
unideb.logFile( logname );
ulog.logFile( logname );
ObjectId shmID = DefaultObjectId;
string sID = conf->getArgParam("--smemory-id");
......@@ -48,7 +48,7 @@ int main(int argc, const char **argv)
IOControl* ic = IOControl::init_iocontrol(argc,argv,shmID);
if( !ic )
{
dlog[Debug::CRIT] << "(iocontrol): init не прошёл..." << endl;
dlog.crit() << "(iocontrol): init не прошёл..." << endl;
return 1;
}
......@@ -58,10 +58,10 @@ int main(int argc, const char **argv)
SystemMessage sm(SystemMessage::StartUp);
act.broadcast( sm.transport_msg() );
unideb(Debug::ANY) << "\n\n\n";
unideb[Debug::ANY] << "(main): -------------- IOControl START -------------------------\n\n";
dlog(Debug::ANY) << "\n\n\n";
dlog[Debug::ANY] << "(main): -------------- IOControl START -------------------------\n\n";
ulog << "\n\n\n";
ulog << "(main): -------------- IOControl START -------------------------\n\n";
dlog << "\n\n\n";
dlog << "(main): -------------- IOControl START -------------------------\n\n";
act.run(true);
msleep(500);
ic->execute();
......@@ -69,15 +69,15 @@ int main(int argc, const char **argv)
}
catch(SystemError& err)
{
dlog[Debug::CRIT] << "(iocontrol): " << err << endl;
dlog.crit() << "(iocontrol): " << err << endl;
}
catch(Exception& ex)
{
dlog[Debug::CRIT] << "(iocontrol): " << ex << endl;
dlog.crit() << "(iocontrol): " << ex << endl;
}
catch(...)
{
dlog[Debug::CRIT] << "(iocontrol): catch(...)" << endl;
dlog.crit() << "(iocontrol): catch(...)" << endl;
}
return 1;
......
......@@ -35,15 +35,15 @@ void LProcessor::execute( const string& lfile )
}
catch( LogicException& ex )
{
dlog[Debug::CRIT] << logname << "(execute): " << ex << endl;
dlog.crit() << logname << "(execute): " << ex << endl;
}
catch( Exception& ex )
{
dlog[Debug::CRIT] << logname << "(execute): " << ex << endl;
dlog.crit() << logname << "(execute): " << ex << endl;
}
catch(...)
{
dlog[Debug::CRIT] << logname << "(execute): catch...\n";
dlog.crit() << logname << "(execute): catch...\n";
}
msleep(sleepTime);
}
......@@ -67,7 +67,7 @@ void LProcessor::build( const string& lfile )
UniSetTypes::ObjectId sid = conf->getSensorID(it->name);
if( sid == DefaultObjectId )
{
dlog[Debug::CRIT] << "НЕ НАЙДЕН ИДЕНТИФИКАТОР ДАТЧИКА: " << it->name << endl;
dlog.crit() << "НЕ НАЙДЕН ИДЕНТИФИКАТОР ДАТЧИКА: " << it->name << endl;
continue;
}
......@@ -78,9 +78,9 @@ void LProcessor::build( const string& lfile )
ei.iotype = conf->getIOType(sid);
if( ei.iotype == UniversalIO::UnknownIOType )
{
dlog[Debug::CRIT] << "Unkown iotype for sid=" << sid << "(" << it->name << ")" << endl;
continue;
}
dlog.crit() << "Unkown iotype for sid=" << sid << "(" << it->name << ")" << endl;
continue;
}
extInputs.push_front(ei);
}
......@@ -89,7 +89,7 @@ void LProcessor::build( const string& lfile )
UniSetTypes::ObjectId sid = conf->getSensorID(it->name);
if( sid == DefaultObjectId )
{
dlog[Debug::CRIT] << "НЕ НАЙДЕН ИДЕНТИФИКАТОР ВЫХОДА: " << it->name << endl;
dlog.crit() << "НЕ НАЙДЕН ИДЕНТИФИКАТОР ВЫХОДА: " << it->name << endl;
continue;
}
......@@ -99,9 +99,9 @@ void LProcessor::build( const string& lfile )
ei.iotype = conf->getIOType(sid);
if( ei.iotype == UniversalIO::UnknownIOType )
{
dlog[Debug::CRIT] << "Unkown iotype for sid=" << sid << "(" << it->name << ")" << endl;
continue;
}
dlog.crit() << "Unkown iotype for sid=" << sid << "(" << it->name << ")" << endl;
continue;
}
extOuts.push_front(ei);
}
......@@ -147,11 +147,11 @@ void LProcessor::setOuts()
}
catch( Exception& ex )
{
dlog[Debug::CRIT] << "(LProcessor::setOuts): " << ex << endl;
dlog.crit() << "(LProcessor::setOuts): " << ex << endl;
}
catch(...)
{
dlog[Debug::CRIT] << "(LProcessor::setOuts): catch...\n";
dlog.crit() << "(LProcessor::setOuts): catch...\n";
}
}
}
......
......@@ -24,7 +24,8 @@ PassiveLProcessor::PassiveLProcessor( std::string lfile, UniSetTypes::ObjectId o
{
ostringstream err;
err << myname << ": ID not found ('HeartBeat') for " << heart;
dlog[Debug::CRIT] << myname << "(init): " << err.str() << endl;
if( dlog.is_crit() )
dlog.crit() << myname << "(init): " << err.str() << endl;
throw SystemError(err.str());
}
......@@ -51,8 +52,8 @@ void PassiveLProcessor::step()
}
catch(Exception& ex )
{
dlog[Debug::CRIT] << myname
<< "(step): (hb) " << ex << std::endl;
if( dlog.is_crit() )
dlog.crit() << myname << "(step): (hb) " << ex << std::endl;
}
if( sidHeartBeat!=DefaultObjectId && ptHeartBeat.checkTime() )
......@@ -64,8 +65,8 @@ void PassiveLProcessor::step()
}
catch(Exception& ex)
{
dlog[Debug::CRIT] << myname
<< "(step): (hb) " << ex << std::endl;
if( dlog.is_crit() )
dlog.crit() << myname << "(step): (hb) " << ex << std::endl;
}
}
......@@ -85,7 +86,8 @@ void PassiveLProcessor::askSensors( UniversalIO::UIOCommand cmd )
}
catch( Exception& ex )
{
dlog[Debug::CRIT] << myname << "(askSensors): " << ex << endl;
if( dlog.is_crit() )
dlog.crit() << myname << "(askSensors): " << ex << endl;
throw SystemError(myname +"(askSensors): do not ask sensors" );
}
}
......@@ -113,7 +115,8 @@ void PassiveLProcessor::sysCommand( UniSetTypes::SystemMessage *sm )
{
if( !shm->waitSMready(smReadyTimeout) )
{
dlog[Debug::CRIT] << myname << "(ERR): SM not ready. Terminated... " << endl;
if( dlog.is_crit() )
dlog.crit() << myname << "(ERR): SM not ready. Terminated... " << endl;
raise(SIGTERM);
return;
}
......@@ -146,12 +149,12 @@ void PassiveLProcessor::sysCommand( UniSetTypes::SystemMessage *sm )
case SystemMessage::LogRotate:
{
// переоткрываем логи
unideb << myname << "(sysCommand): logRotate" << std::endl;
string fname = unideb.getLogFile();
ulog << myname << "(sysCommand): logRotate" << std::endl;
string fname (ulog.getLogFile() );
if( !fname.empty() )
{
unideb.logFile(fname);
unideb << myname << "(sysCommand): ***************** UNIDEB LOG ROTATE *****************" << std::endl;
ulog.logFile(fname);
ulog << myname << "(sysCommand): ***************** UNIDEB LOG ROTATE *****************" << std::endl;
}
dlog << myname << "(sysCommand): logRotate" << std::endl;
......@@ -199,11 +202,11 @@ void PassiveLProcessor::setOuts()
}
catch( Exception& ex )
{
dlog[Debug::CRIT] << myname << "(setOuts): " << ex << endl;
dlog.crit() << myname << "(setOuts): " << ex << endl;
}
catch(...)
{
dlog[Debug::CRIT] << myname << "(setOuts): catch...\n";
dlog.crit() << myname << "(setOuts): catch...\n";
}
}
}
......@@ -218,11 +221,11 @@ void PassiveLProcessor::sigterm( int signo )
}
catch( Exception& ex )
{
dlog[Debug::CRIT] << myname << "(sigterm): " << ex << endl;
dlog.crit() << myname << "(sigterm): " << ex << endl;
}
catch(...)
{
dlog[Debug::CRIT] << myname << "(sigterm): catch...\n";
dlog.crit() << myname << "(sigterm): catch...\n";
}
}
}
......@@ -260,7 +263,7 @@ void PassiveLProcessor::processingMessage( UniSetTypes::VoidMessage* msg )
}
catch(Exception& ex)
{
dlog[Debug::CRIT] << myname << "(processingMessage): " << ex << endl;
dlog.crit() << myname << "(processingMessage): " << ex << endl;
}
}
// -----------------------------------------------------------------------------
......@@ -110,8 +110,8 @@ void Schema::extlink( const string& name, Element::ElementID childID, int numIn
// -------------------------------------------------------------------------
Element* Schema::manage( Element* el )
{
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "Schema: manage new element id=" << el->getId()
if( dlog.is_info() )
dlog.info() << "Schema: manage new element id=" << el->getId()
<< " type=" << el->getType()
<< " inputs=" << el->inCount() << endl;
......
......@@ -47,9 +47,9 @@ void TAND::setIn( int num, bool state )
if( !brk )
myout = true;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << this << ": myout " << myout << endl;
if( dlog.is_info() )
dlog.info() << this << ": myout " << myout << endl;
if( prev != myout )
Element::setChildOut();
}
......
......@@ -30,8 +30,10 @@ void TDelay::setIn( int num, bool state )
{
pt.setTiming(0); // reset timer
myout = false;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << this << ": set " << myout << endl;
if( dlog.is_info() )
dlog.info() << this << ": set " << myout << endl;
if( prev != myout )
Element::setChildOut();
return;
......@@ -44,8 +46,10 @@ void TDelay::setIn( int num, bool state )
{
pt.setTiming(0); // reset timer
myout = true;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << this << ": set " << myout << endl;
if( dlog.is_info() )
dlog.info() << this << ": set " << myout << endl;
if( prev != myout )
Element::setChildOut();
return;
......@@ -54,8 +58,9 @@ void TDelay::setIn( int num, bool state )
// засекаем, если ещё не установлен таймер
if( !myout && !prev ) // т.е. !myout && prev != myout
{
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << this << ": set timer " << delay << " [msec]" << endl;
if( dlog.is_info() )
dlog.info() << this << ": set timer " << delay << " [msec]" << endl;
pt.setTiming(delay);
}
}
......@@ -66,8 +71,8 @@ void TDelay::tick()
{
myout = true;
pt.setTiming(0); // reset timer
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << getType() << "(" << myid << "): TIMER!!!! myout=" << myout << endl;
if( dlog.is_info() )
dlog.info() << getType() << "(" << myid << "): TIMER!!!! myout=" << myout << endl;
Element::setChildOut();
}
}
......
......@@ -22,9 +22,9 @@ void TNOT::setIn( int num, bool state )
bool prev = myout;
myout = !state;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << this << ": myout " << myout << endl;
if( dlog.is_info() )
dlog.info() << this << ": myout " << myout << endl;
if( prev != myout )
Element::setChildOut();
}
......
......@@ -60,8 +60,9 @@ void TOR::setIn( int num, bool state )
if( !brk )
myout = false;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << this << ": myout " << myout << endl;
if( dlog.is_info() )
dlog.info() << this << ": myout " << myout << endl;
if( prev != myout )
Element::setChildOut();
}
......
......@@ -23,13 +23,13 @@ int main(int argc, const char **argv)
std::ostringstream logname;
string dir(conf->getLogDir());
logname << dir << logfilename;
unideb.logFile( logname.str() );
ulog.logFile( logname.str() );
dlog.logFile( logname.str() );
string schema = conf->getArgParam("--schema");
if( schema.empty() )
{
dlog[Debug::CRIT] << "schema-file not defined. Use --schema" << endl;
dlog.crit() << "schema-file not defined. Use --schema" << endl;
return 1;
}
......
......@@ -25,7 +25,7 @@ int main(int argc, const char **argv)
std::ostringstream logname;
string dir(conf->getLogDir());
logname << dir << logfilename;
unideb.logFile( logname.str() );
ulog.logFile( logname.str() );
dlog.logFile( logname.str() );
string schema = conf->getArgParam("--schema");
......@@ -76,10 +76,10 @@ int main(int argc, const char **argv)
SystemMessage sm(SystemMessage::StartUp);
act.broadcast( sm.transport_msg() );
unideb(Debug::ANY) << "\n\n\n";
unideb[Debug::ANY] << "(main): -------------- IOControl START -------------------------\n\n";
dlog(Debug::ANY) << "\n\n\n";
dlog[Debug::ANY] << "(main): -------------- IOControl START -------------------------\n\n";
ulog << "\n\n\n";
ulog << "(main): -------------- IOControl START -------------------------\n\n";
dlog << "\n\n\n";
dlog << "(main): -------------- IOControl START -------------------------\n\n";
act.run(false);
return 0;
}
......
......@@ -38,7 +38,7 @@ pollThread(0)
prop_prefix = "";
}
dlog[Debug::INFO] << myname << "(init): prop_prefix=" << prop_prefix << endl;
dlog.info() << myname << "(init): prop_prefix=" << prop_prefix << endl;
UniXML_iterator it(cnode);
......@@ -55,7 +55,7 @@ pollThread(0)
force_disconnect = conf->getArgInt("--" + prefix + "-persistent-connection",it.getProp("persistent_connection")) ? false : true;
dlog[Debug::INFO] << myname << "(init): persisten-connection=" << (!force_disconnect) << endl;
dlog.info() << myname << "(init): persisten-connection=" << (!force_disconnect) << endl;
if( shm->isLocalwork() )
{
......@@ -68,7 +68,7 @@ pollThread(0)
pollThread = new ThreadCreator<MBTCPMaster>(this, &MBTCPMaster::poll_thread);
if( dlog.debugging(Debug::INFO) )
if( dlog.is_info() )
printMap(rmap);
}
// -----------------------------------------------------------------------------
......@@ -106,16 +106,16 @@ ModbusClient* MBTCPMaster::initMB( bool reopen )
mbtcp->setAfterSendPause(aftersend_pause);
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << myname << "(init): ipaddr=" << iaddr << " port=" << port << endl;
if( dlog.is_info() )
dlog.info() << myname << "(init): ipaddr=" << iaddr << " port=" << port << endl;
if( dlog.debugging(Debug::LEVEL9) )
mbtcp->setLog(dlog);
}
catch( ModbusRTU::mbException& ex )
{
if( dlog.debugging(Debug::WARN) )
dlog[Debug::WARN] << "(init): " << ex << endl;
if( dlog.is_warn() )
dlog.warn() << "(init): " << ex << endl;
}
catch(...)
{
......@@ -183,7 +183,7 @@ MBTCPMaster* MBTCPMaster::init_mbmaster( int argc, const char* const* argv,
if( name.empty() )
{
if( dlog.debugging(Debug::CRIT) )
dlog[Debug::CRIT] << "(MBTCPMaster): Не задан name'" << endl;
dlog.crit() << "(MBTCPMaster): Не задан name'" << endl;
return 0;
}
......@@ -191,14 +191,14 @@ MBTCPMaster* MBTCPMaster::init_mbmaster( int argc, const char* const* argv,
if( ID == UniSetTypes::DefaultObjectId )
{
if( dlog.debugging(Debug::CRIT) )
dlog[Debug::CRIT] << "(MBTCPMaster): идентификатор '" << name
dlog.crit() << "(MBTCPMaster): идентификатор '" << name
<< "' не найден в конф. файле!"
<< " в секции " << conf->getObjectsSection() << endl;
return 0;
}
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "(MBTCPMaster): name = " << name << "(" << ID << ")" << endl;
if( dlog.is_info() )
dlog.info() << "(MBTCPMaster): name = " << name << "(" << ID << ")" << endl;
return new MBTCPMaster(ID,icID,ic,prefix);
}
// -----------------------------------------------------------------------------
......@@ -40,7 +40,8 @@ checkThread(0)
prop_prefix = "";
}
dlog[Debug::INFO] << myname << "(init): prop_prefix=" << prop_prefix << endl;
if( dlog.is_info() )
dlog.info() << myname << "(init): prop_prefix=" << prop_prefix << endl;
UniXML_iterator it(cnode);
......@@ -52,7 +53,8 @@ checkThread(0)
{
ostringstream err;
err << myname << "(init): not found <GateList>";
dlog[Debug::CRIT] << err.str() << endl;
if( dlog.is_crit() )
dlog.crit() << err.str() << endl;
throw UniSetTypes::SystemError(err.str());
}
......@@ -60,7 +62,8 @@ checkThread(0)
{
ostringstream err;
err << myname << "(init): empty <GateList> ?!";
dlog[Debug::CRIT] << err.str() << endl;
if( dlog.is_crit() )
dlog.crit() << err.str() << endl;
throw UniSetTypes::SystemError(err.str());
}
......@@ -72,7 +75,8 @@ checkThread(0)
{
ostringstream err;
err << myname << "(init): ip='' in <GateList>";
dlog[Debug::CRIT] << err.str() << endl;
if( dlog.is_crit() )
dlog.crit() << err.str() << endl;
throw UniSetTypes::SystemError(err.str());
}
......@@ -81,7 +85,8 @@ checkThread(0)
{
ostringstream err;
err << myname << "(init): ERROR: port=''" << sinf.port << " for ip='" << sinf.ip << "' in <GateList>";
dlog[Debug::CRIT] << err.str() << endl;
if( dlog.is_crit() )
dlog.crit() << err.str() << endl;
throw UniSetTypes::SystemError(err.str());
}
......@@ -92,7 +97,8 @@ checkThread(0)
{
ostringstream err;
err << myname << "(init): ERROR: Unknown SensorID for '" << it1.getProp("respond") << "' in <GateList>";
dlog[Debug::CRIT] << err.str() << endl;
if( dlog.is_crit() )
dlog.crit() << err.str() << endl;
throw UniSetTypes::SystemError(err.str());
}
}
......@@ -116,15 +122,16 @@ checkThread(0)
mblist.push_back(sinf);
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << myname << "(init): add slave channel " << sinf.myname << endl;
if( dlog.is_info() )
dlog.info() << myname << "(init): add slave channel " << sinf.myname << endl;
}
if( mblist.empty() )
{
ostringstream err;
err << myname << "(init): empty <GateList>!";
dlog[Debug::CRIT] << err.str() << endl;
if( dlog.is_crit() )
dlog.crit() << err.str() << endl;
throw UniSetTypes::SystemError(err.str());
}
......@@ -148,8 +155,7 @@ checkThread(0)
// неудачной попытки запросов по одному из каналов, то ПЕРЕОПРЕДЕЛЯЕМ reopen, на timeout..
ptReopen.setTiming(ptTimeout.getInterval());
if( dlog.debugging(Debug::INFO) )
if( dlog.is_info() )
printMap(rmap);
}
// -----------------------------------------------------------------------------
......@@ -228,8 +234,8 @@ bool MBTCPMultiMaster::MBSlaveInfo::init()
{
// ost::Thread::setException(ost::Thread::throwException);
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << myname << "(init): connect..." << endl;
if( dlog.is_info() )
dlog.info() << myname << "(init): connect..." << endl;
mbtcp->connect(ip,port);
mbtcp->setForceDisconnect(force_disconnect);
......@@ -242,22 +248,22 @@ bool MBTCPMultiMaster::MBSlaveInfo::init()
mbtcp->setSleepPause(sleepPause_usec);
mbtcp->setAfterSendPause(aftersend_pause);
if( mbtcp->isConnection() && dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "(init): " << myname << " connect OK" << endl;
if( mbtcp->isConnection() && dlog.is_info() )
dlog.info() << "(init): " << myname << " connect OK" << endl;
initOK = true;
}
return mbtcp->isConnection();
}
catch( ModbusRTU::mbException& ex )
{
if( dlog.debugging(Debug::WARN) )
dlog[Debug::WARN] << "(init): " << ex << endl;
if( dlog.is_warn() )
dlog.warn() << "(init): " << ex << endl;
}
catch(...)
{
if( dlog.debugging(Debug::WARN) )
dlog[Debug::WARN] << "(init): " << myname << " catch ..." << endl;
if( dlog.is_warn() )
dlog.warn() << "(init): " << myname << " catch ..." << endl;
}
initOK = false;
......@@ -312,8 +318,8 @@ void MBTCPMultiMaster::check_thread()
try
{
bool r = it->check();
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << myname << "(check): " << it->myname << " " << ( r ? "OK" : "FAIL" ) << endl;
if( dlog.is_info() )
dlog.info() << myname << "(check): " << it->myname << " " << ( r ? "OK" : "FAIL" ) << endl;
try
{
......@@ -326,7 +332,7 @@ void MBTCPMultiMaster::check_thread()
catch( Exception& ex )
{
if( dlog.debugging(Debug::CRIT) )
dlog[Debug::CRIT] << myname << "(check): (respond) " << ex << std::endl;
dlog.crit() << myname << "(check): (respond) " << ex << std::endl;
}
catch(...){}
......@@ -376,20 +382,20 @@ MBTCPMultiMaster* MBTCPMultiMaster::init_mbmaster( int argc, const char* const*
string name = conf->getArgParam("--" + prefix + "-name","MBTCPMultiMaster1");
if( name.empty() )
{
dlog[Debug::CRIT] << "(MBTCPMultiMaster): Не задан name'" << endl;
dlog.crit() << "(MBTCPMultiMaster): Не задан name'" << endl;
return 0;
}
ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
{
dlog[Debug::CRIT] << "(MBTCPMultiMaster): идентификатор '" << name
dlog.crit() << "(MBTCPMultiMaster): идентификатор '" << name
<< "' не найден в конф. файле!"
<< " в секции " << conf->getObjectsSection() << endl;
return 0;
}
dlog[Debug::INFO] << "(MBTCPMultiMaster): name = " << name << "(" << ID << ")" << endl;
dlog.info() << "(MBTCPMultiMaster): name = " << name << "(" << ID << ")" << endl;
return new MBTCPMultiMaster(ID,icID,ic,prefix);
}
// -----------------------------------------------------------------------------
......@@ -38,7 +38,7 @@ rs_pre_clean(false)
prop_prefix = "";
}
dlog[Debug::INFO] << myname << "(init): prop_prefix=" << prop_prefix << endl;
dlog.info() << myname << "(init): prop_prefix=" << prop_prefix << endl;
UniXML_iterator it(cnode);
......@@ -69,7 +69,7 @@ rs_pre_clean(false)
initMB(false);
if( dlog.debugging(Debug::INFO) )
if( dlog.is_info() )
printMap(rmap);
}
// -----------------------------------------------------------------------------
......@@ -130,23 +130,23 @@ ModbusClient* RTUExchange::initMB( bool reopen )
mbrtu->setSleepPause(sleepPause_usec);
mbrtu->setAfterSendPause(aftersend_pause);
dlog[Debug::INFO] << myname << "(init): dev=" << devname << " speed=" << ComPort::getSpeed( mbrtu->getSpeed() ) << endl;
dlog.info() << myname << "(init): dev=" << devname << " speed=" << ComPort::getSpeed( mbrtu->getSpeed() ) << endl;
}
catch( Exception& ex )
{
if( mbrtu )
delete mbrtu;
mbrtu = 0;
dlog[Debug::WARN] << myname << "(init): " << ex << endl;
dlog.warn() << myname << "(init): " << ex << endl;
}
catch(...)
{
if( mbrtu )
delete mbrtu;
mbrtu = 0;
dlog[Debug::INFO] << myname << "(init): catch...." << endl;
dlog.info() << myname << "(init): catch...." << endl;
}
mb = mbrtu;
......@@ -244,7 +244,7 @@ void RTUExchange::poll()
{
if( dlog.debugging(Debug::LEVEL3) )
{
dlog[Debug::CRIT] << myname << "(poll): FAILED ask addr=" << ModbusRTU::addr2str(d->mbaddr)
dlog.crit() << myname << "(poll): FAILED ask addr=" << ModbusRTU::addr2str(d->mbaddr)
<< " -> " << ex << endl;
}
d->resp_real = false;
......@@ -318,8 +318,8 @@ void RTUExchange::poll()
if( allNotRespond && ptReopen.checkTime() )
{
uniset_mutex_lock l(pollMutex, 300);
if( dlog.debugging(Debug::WARN) )
dlog[Debug::WARN] << myname << ": REOPEN timeout..(" << ptReopen.getInterval() << ")" << endl;
if( dlog.is_warn() )
dlog.warn() << myname << ": REOPEN timeout..(" << ptReopen.getInterval() << ")" << endl;
mb = initMB(true);
ptReopen.reset();
......@@ -347,7 +347,7 @@ RTUExchange* RTUExchange::init_rtuexchange( int argc, const char* const* argv, U
return 0;
}
dlog[Debug::INFO] << "(rtuexchange): name = " << name << "(" << ID << ")" << endl;
dlog.info() << "(rtuexchange): name = " << name << "(" << ID << ")" << endl;
return new RTUExchange(ID,icID,ic,prefix);
}
// -----------------------------------------------------------------------------
......@@ -359,7 +359,7 @@ bool RTUExchange::initDeviceInfo( RTUDeviceMap& m, ModbusRTU::ModbusAddr a, UniX
RTUDeviceMap::iterator d = m.find(a);
if( d == m.end() )
{
dlog[Debug::WARN] << myname << "(initDeviceInfo): not found device for addr=" << ModbusRTU::addr2str(a) << endl;
dlog.warn() << myname << "(initDeviceInfo): not found device for addr=" << ModbusRTU::addr2str(a) << endl;
return false;
}
......@@ -370,7 +370,7 @@ bool RTUExchange::initDeviceInfo( RTUDeviceMap& m, ModbusRTU::ModbusAddr a, UniX
if( d->second->speed == ComPort::ComSpeed0 )
{
d->second->speed = defSpeed;
dlog[Debug::CRIT] << myname << "(initDeviceInfo): Unknown speed=" << s <<
dlog.crit() << myname << "(initDeviceInfo): Unknown speed=" << s <<
" for addr=" << ModbusRTU::addr2str(a) << endl;
return false;
}
......
......@@ -36,7 +36,7 @@ int main( int argc, const char** argv )
std::ostringstream logname;
string dir(conf->getLogDir());
logname << dir << logfilename;
unideb.logFile( logname.str() );
ulog.logFile( logname.str() );
dlog.logFile( logname.str() );
ObjectId shmID = DefaultObjectId;
......@@ -55,7 +55,7 @@ int main( int argc, const char** argv )
MBTCPMaster* mb = MBTCPMaster::init_mbmaster(argc,argv,shmID);
if( !mb )
{
dlog[Debug::CRIT] << "(mbmaster): init MBTCPMaster failed." << endl;
dlog.crit() << "(mbmaster): init MBTCPMaster failed." << endl;
return 1;
}
......@@ -65,21 +65,21 @@ int main( int argc, const char** argv )
SystemMessage sm(SystemMessage::StartUp);
act.broadcast( sm.transport_msg() );
unideb(Debug::ANY) << "\n\n\n";
unideb[Debug::ANY] << "(main): -------------- MBTCP Exchange START -------------------------\n\n";
dlog(Debug::ANY) << "\n\n\n";
dlog[Debug::ANY] << "(main): -------------- MBTCP Exchange START -------------------------\n\n";
ulog << "\n\n\n";
ulog << "(main): -------------- MBTCP Exchange START -------------------------\n\n";
dlog << "\n\n\n";
dlog << "(main): -------------- MBTCP Exchange START -------------------------\n\n";
act.run(false);
while( waitpid(-1, 0, 0) > 0 );
return 0;
}
catch( Exception& ex )
{
dlog[Debug::CRIT] << "(mbtcpmaster): " << ex << std::endl;
dlog.crit() << "(mbtcpmaster): " << ex << std::endl;
}
catch(...)
{
dlog[Debug::CRIT] << "(mbtcpmaster): catch ..." << std::endl;
dlog.crit() << "(mbtcpmaster): catch ..." << std::endl;
}
while( waitpid(-1, 0, 0) > 0 );
......
......@@ -36,7 +36,7 @@ int main( int argc, const char** argv )
std::ostringstream logname;
string dir(conf->getLogDir());
logname << dir << logfilename;
unideb.logFile( logname.str() );
ulog.logFile( logname.str() );
dlog.logFile( logname.str() );
ObjectId shmID = DefaultObjectId;
......@@ -55,7 +55,7 @@ int main( int argc, const char** argv )
MBTCPMultiMaster* mb = MBTCPMultiMaster::init_mbmaster(argc,argv,shmID);
if( !mb )
{
dlog[Debug::CRIT] << "(mbmaster): init MBTCPMaster failed." << endl;
dlog.crit() << "(mbmaster): init MBTCPMaster failed." << endl;
return 1;
}
......@@ -65,21 +65,23 @@ int main( int argc, const char** argv )
SystemMessage sm(SystemMessage::StartUp);
act.broadcast( sm.transport_msg() );
unideb(Debug::ANY) << "\n\n\n";
unideb[Debug::ANY] << "(main): -------------- MBTCPMulti Exchange START -------------------------\n\n";
dlog(Debug::ANY) << "\n\n\n";
dlog[Debug::ANY] << "(main): -------------- MBTCPMulti Exchange START -------------------------\n\n";
ulog << "\n\n\n";
ulog << "(main): -------------- MBTCPMulti Exchange START -------------------------\n\n";
dlog << "\n\n\n";
dlog << "(main): -------------- MBTCPMulti Exchange START -------------------------\n\n";
act.run(false);
while( waitpid(-1, 0, 0) > 0 );
while( waitpid(-1, 0, 0) > 0 );
return 0;
}
catch( Exception& ex )
{
dlog[Debug::CRIT] << "(mbtcpmultimaster): " << ex << std::endl;
dlog.crit() << "(mbtcpmultimaster): " << ex << std::endl;
}
catch(...)
{
dlog[Debug::CRIT] << "(mbtcpmultimaster): catch ..." << std::endl;
dlog.crit() << "(mbtcpmultimaster): catch ..." << std::endl;
}
while( waitpid(-1, 0, 0) > 0 );
......
......@@ -34,7 +34,7 @@ int main( int argc, char** argv )
std::ostringstream logname;
string dir(conf->getLogDir());
logname << dir << logfilename;
unideb.logFile( logname.str() );
ulog.logFile( logname.str() );
dlog.logFile( logname.str() );
ObjectId shmID = DefaultObjectId;
......@@ -53,7 +53,7 @@ int main( int argc, char** argv )
RTUExchange* rs = RTUExchange::init_rtuexchange(argc,argv,shmID,0,"rs");
if( !rs )
{
dlog[Debug::CRIT] << "(rtuexchange): init не прошёл..." << endl;
dlog.crit() << "(rtuexchange): init не прошёл..." << endl;
return 1;
}
......@@ -63,10 +63,10 @@ int main( int argc, char** argv )
SystemMessage sm(SystemMessage::StartUp);
act.broadcast( sm.transport_msg() );
unideb(Debug::ANY) << "\n\n\n";
unideb[Debug::ANY] << "(main): -------------- RTU Exchange START -------------------------\n\n";
dlog(Debug::ANY) << "\n\n\n";
dlog[Debug::ANY] << "(main): -------------- RTU Exchange START -------------------------\n\n";
ulog << "\n\n\n";
ulog << "(main): -------------- RTU Exchange START -------------------------\n\n";
dlog << "\n\n\n";
dlog << "(main): -------------- RTU Exchange START -------------------------\n\n";
act.run(false);
......@@ -75,11 +75,11 @@ int main( int argc, char** argv )
}
catch( Exception& ex )
{
dlog[Debug::CRIT] << "(rtuexchange): " << ex << std::endl;
dlog.crit() << "(rtuexchange): " << ex << std::endl;
}
catch(...)
{
dlog[Debug::CRIT] << "(rtuexchange): catch ..." << std::endl;
dlog.crit() << "(rtuexchange): catch ..." << std::endl;
}
while( waitpid(-1, 0, 0) > 0 );
......
......@@ -39,7 +39,7 @@ int main(int argc, const char **argv)
std::ostringstream logname;
string dir(conf->getLogDir());
logname << dir << logfilename;
unideb.logFile( logname.str() );
ulog.logFile( logname.str() );
dlog.logFile( logname.str() );
conf->initDebug(dlog,"dlog");
......@@ -60,7 +60,7 @@ int main(int argc, const char **argv)
MBSlave* s = MBSlave::init_mbslave(argc,argv,shmID);
if( !s )
{
dlog[Debug::CRIT] << "(mbslave): init не прошёл..." << endl;
dlog.crit() << "(mbslave): init не прошёл..." << endl;
return 1;
}
......@@ -69,10 +69,10 @@ int main(int argc, const char **argv)
SystemMessage sm(SystemMessage::StartUp);
act.broadcast( sm.transport_msg() );
unideb(Debug::ANY) << "\n\n\n";
unideb[Debug::ANY] << "(main): -------------- MBSlave START -------------------------\n\n";
dlog(Debug::ANY) << "\n\n\n";
dlog[Debug::ANY] << "(main): -------------- MBSlave START -------------------------\n\n";
ulog << "\n\n\n";
ulog << "(main): -------------- MBSlave START -------------------------\n\n";
dlog << "\n\n\n";
dlog << "(main): -------------- MBSlave START -------------------------\n\n";
act.run(false);
while( waitpid(-1, 0, 0) > 0 );
......@@ -80,19 +80,19 @@ int main(int argc, const char **argv)
}
catch( SystemError& err )
{
dlog[Debug::CRIT] << "(mbslave): " << err << endl;
dlog.crit() << "(mbslave): " << err << endl;
}
catch( Exception& ex )
{
dlog[Debug::CRIT] << "(mbslave): " << ex << endl;
dlog.crit() << "(mbslave): " << ex << endl;
}
catch( std::exception& e )
{
dlog[Debug::CRIT] << "(mbslave): " << e.what() << endl;
dlog.crit() << "(mbslave): " << e.what() << endl;
}
catch(...)
{
dlog[Debug::CRIT] << "(mbslave): catch(...)" << endl;
dlog.crit() << "(mbslave): catch(...)" << endl;
}
while( waitpid(-1, 0, 0) > 0 );
......
......@@ -25,7 +25,8 @@ prefix(prefix)
{
ostringstream err;
err << myname << "(init): empty rrd list...";
RRDServer::dlog[Debug::CRIT] << err.str() << endl;
if( RRDServer::dlog.is_crit() )
RRDServer::dlog.crit() << err.str() << endl;
throw NameNotFound(err.str());
}
......@@ -57,10 +58,10 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
int lastup = it.getPIntProp("lastup",0);
bool overwrite = it.getPIntProp("overwrite",0);
if( RRDServer::dlog.debugging(Debug::INFO) )
RRDServer::dlog[Debug::INFO] << myname << "(init): add rrd: file='" << fname
<< " " << ff << "='" << fv
<< "' create='" << cf << "'"
if( RRDServer::dlog.is_info() )
RRDServer::dlog.info() << myname << "(init): add rrd: file='" << fname
<< " " << ff << "='" << fv
<< "' create='" << cf << "'"
<< " step=" << rrdstep
<< endl;
......@@ -71,7 +72,7 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
{
ostringstream err;
err << myname << "(init): rrd='" << fname << "' Unknown RRA list";
RRDServer::dlog[Debug::CRIT] << err.str();
RRDServer::dlog.crit() << err.str();
throw SystemError(err.str());
}
......@@ -82,7 +83,8 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
{
ostringstream err;
err << myname << "(init): rrd='" << fname << "' Unkown RRA item.. <item rra='...'";
RRDServer::dlog[Debug::CRIT] << err.str();
if( RRDServer::dlog.is_crit() )
RRDServer::dlog.crit() << err.str();
throw SystemError(err.str());
}
......@@ -93,7 +95,8 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
{
ostringstream err;
err << myname << "(init): Not found RRA items...";
RRDServer::dlog[Debug::CRIT] << err.str() << endl;
if( RRDServer::dlog.is_crit() )
RRDServer::dlog.crit() << err.str() << endl;
throw SystemError(err.str());
}
......@@ -105,7 +108,8 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
{
ostringstream err;
err << myname << "(init): Not found section <sensors>";
RRDServer::dlog[Debug::CRIT] << err.str();
if( RRDServer::dlog.is_crit() )
RRDServer::dlog.crit() << err.str();
throw SystemError(err.str());
}
......@@ -114,7 +118,8 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
{
ostringstream err;
err << myname << "(init): section <sensors> empty?!";
RRDServer::dlog[Debug::CRIT] << err.str();
if( RRDServer::dlog.is_crit() )
RRDServer::dlog.crit() << err.str();
throw SystemError(err.str());
}
......@@ -133,7 +138,8 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
{
ostringstream err;
err << myname << "(init): Unknown create parameters ('" << cf << "')";
RRDServer::dlog[Debug::CRIT] << err.str();
if( RRDServer::dlog.is_crit() )
RRDServer::dlog.crit() << err.str();
throw SystemError(err.str());
}
......@@ -147,7 +153,8 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
{
ostringstream err;
err << myname << "(init): Unknown SensorID for '" << dsname << "'";
RRDServer::dlog[Debug::CRIT] << err.str();
if( RRDServer::dlog.is_crit() )
RRDServer::dlog.crit() << err.str();
throw SystemError(err.str());
}
......@@ -159,7 +166,8 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
{
ostringstream err;
err << myname << "(init): Not found RRD items...";
RRDServer::dlog[Debug::CRIT] << err.str() << endl;
if( RRDServer::dlog.is_crit() )
RRDServer::dlog.crit() << err.str() << endl;
throw SystemError(err.str());
}
......@@ -179,8 +187,8 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
// Собственно создаём RRD
if( !overwrite && file_exist(fname) )
{
if( RRDServer::dlog.debugging(Debug::INFO) )
RRDServer::dlog[Debug::INFO] << myname << "(init): ignore create file='" << fname
if( RRDServer::dlog.is_info() )
RRDServer::dlog.info() << myname << "(init): ignore create file='" << fname
<< "'. File exist... overwrite=0." << endl;
}
else
......@@ -190,7 +198,8 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
{
ostringstream err;
err << myname << "(init): Can`t create RRD ('" << fname << "'): err: " << string(rrd_get_error());
RRDServer::dlog[Debug::CRIT] << err.str() << endl;
if( RRDServer::dlog.is_crit() )
RRDServer::dlog.crit() << err.str() << endl;
throw SystemError(err.str());
}
}
......@@ -205,12 +214,12 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
rrdlist.push_back(rrd);
}
/* catch( Exception& ex )
{
RRDServer::dlog[Debug::CRIT] << myname << "(init) " << ex << std::endl;
{
RRDServer::dlog.crit() << myname << "(init) " << ex << std::endl;
}
catch( ... )
{
RRDServer::dlog[Debug::CRIT] << myname << "(init): catch ..." << std::endl;
{
RRDServer::dlog.crit() << myname << "(init): catch ..." << std::endl;
}
*/
}
......@@ -231,14 +240,14 @@ RRDServer* RRDServer::init_rrdstorage( int argc, const char* const* argv,
string name = conf->getArgParam("--" + prefix + "-name","RRDServer");
if( name.empty() )
{
UniSetExtensions::dlog[Debug::CRIT] << "(RRDServer): Unknown name. Usage: --" << prefix << "-name" << endl;
UniSetExtensions::dlog.crit() << "(RRDServer): Unknown name. Usage: --" << prefix << "-name" << endl;
return 0;
}
ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
{
UniSetExtensions::dlog[Debug::CRIT] << "(RRDServer): Not found ID for '" << name
UniSetExtensions::dlog.crit() << "(RRDServer): Not found ID for '" << name
<< " in '" << conf->getObjectsSection() << "' section" << endl;
return 0;
}
......@@ -247,11 +256,12 @@ RRDServer* RRDServer::init_rrdstorage( int argc, const char* const* argv,
xmlNode* cnode = conf->getNode(confname);
if( !cnode )
{
UniSetExtensions::dlog[Debug::CRIT] << "(RRDServer): " << name << "(init): Not found <" + confname + ">" << endl;
UniSetExtensions::dlog.crit() << "(RRDServer): " << name << "(init): Not found <" + confname + ">" << endl;
return 0;
}
UniSetExtensions::dlog[Debug::INFO] << "(RRDServer): name = " << name << "(" << ID << ")" << endl;
if( UniSetExtensions::dlog.is_info() )
UniSetExtensions::dlog.info() << "(RRDServer): name = " << name << "(" << ID << ")" << endl;
return new RRDServer(ID,cnode,icID,ic,prefix);
}
// -----------------------------------------------------------------------------
......@@ -269,7 +279,8 @@ void RRDServer::askSensors( UniversalIO::UIOCommand cmd )
}
catch( std::exception& ex )
{
RRDServer::dlog[Debug::CRIT] << myname << "(askSensors): " << ex.what() << endl;
if( RRDServer::dlog.is_crit() )
RRDServer::dlog.crit() << myname << "(askSensors): " << ex.what() << endl;
}
}
}
......@@ -288,7 +299,8 @@ void RRDServer::sysCommand( UniSetTypes::SystemMessage* sm )
}
catch( std::exception& ex )
{
RRDServer::dlog[Debug::CRIT] << myname << "(askTimer): " << ex.what() << endl;
if( RRDServer::dlog.is_crit() )
RRDServer::dlog.crit() << myname << "(askTimer): " << ex.what() << endl;
}
}
}
......@@ -318,8 +330,8 @@ void RRDServer::timerInfo( UniSetTypes::TimerMessage* tm )
for( DSMap::iterator s=it->dsmap.begin(); s!=it->dsmap.end(); ++s )
v << ":" << s->second.value;
if( RRDServer::dlog.debugging(Debug::INFO) )
RRDServer::dlog[Debug::INFO] << myname << "(update): '" << it->filename << "' " << v.str() << endl;
if( RRDServer::dlog.is_info() )
RRDServer::dlog.info() << myname << "(update): '" << it->filename << "' " << v.str() << endl;
rrd_clear_error();
const char* argv = v.str().c_str();
......@@ -327,7 +339,8 @@ void RRDServer::timerInfo( UniSetTypes::TimerMessage* tm )
{
ostringstream err;
err << myname << "(update): Can`t update RRD ('" << it->filename << "'): err: " << string(rrd_get_error());
RRDServer::dlog[Debug::CRIT] << err.str() << endl;
if( RRDServer::dlog.is_crit() )
RRDServer::dlog.crit() << err.str() << endl;
}
break;
......
......@@ -35,7 +35,7 @@ int main( int argc, const char** argv )
std::ostringstream logname;
string dir(conf->getLogDir());
logname << dir << logfilename;
unideb.logFile( logname.str() );
ulog.logFile( logname.str() );
dlog.logFile( logname.str() );
ObjectId shmID = DefaultObjectId;
......@@ -54,7 +54,7 @@ int main( int argc, const char** argv )
RRDServer* db = RRDServer::init_rrdstorage(argc,argv,shmID);
if( !db )
{
dlog[Debug::CRIT] << "(rrdstorage): init не прошёл..." << endl;
dlog.crit() << "(rrdstorage): init не прошёл..." << endl;
return 1;
}
......@@ -64,20 +64,20 @@ int main( int argc, const char** argv )
SystemMessage sm(SystemMessage::StartUp);
act.broadcast( sm.transport_msg() );
unideb(Debug::ANY) << "\n\n\n";
unideb[Debug::ANY] << "(main): -------------- RRDServer START -------------------------\n\n";
dlog(Debug::ANY) << "\n\n\n";
dlog[Debug::ANY] << "(main): -------------- RRDServer START -------------------------\n\n";
ulog << "\n\n\n";
ulog << "(main): -------------- RRDServer START -------------------------\n\n";
dlog << "\n\n\n";
dlog << "(main): -------------- RRDServer START -------------------------\n\n";
act.run(false);
return 0;
}
catch( UniSetTypes::Exception& ex )
{
dlog[Debug::CRIT] << "(rrdstorage): " << ex << std::endl;
dlog.crit() << "(rrdstorage): " << ex << std::endl;
}
catch(...)
{
dlog[Debug::CRIT] << "(rrdstorage): catch ..." << std::endl;
dlog.crit() << "(rrdstorage): catch ..." << std::endl;
}
return 1;
......
......@@ -42,7 +42,7 @@ prefix(prefix)
{
ostringstream err;
err << myname << ": ID not found ('HeartBeat') for " << heart;
dlog[Debug::CRIT] << myname << "(init): " << err.str() << endl;
dlog.crit() << myname << "(init): " << err.str() << endl;
throw SystemError(err.str());
}
......@@ -62,12 +62,12 @@ prefix(prefix)
{
ostringstream err;
err << myname << "(init): test_id unknown. 'TestMode_S' not found...";
dlog[Debug::CRIT] << myname << "(init): " << err.str() << endl;
dlog.crit() << myname << "(init): " << err.str() << endl;
throw SystemError(err.str());
}
}
dlog[Debug::INFO] << myname << "(init): test_id=" << test_id << endl;
dlog.info() << myname << "(init): test_id=" << test_id << endl;
}
......@@ -90,7 +90,7 @@ void SMDBServer::waitSMReady()
{
ostringstream err;
err << myname << "(waitSMReady): Wait SharedMemory failed. [ " << ready_timeout << " msec ]";
dlog[Debug::CRIT] << err.str() << endl;
dlog.crit() << err.str() << endl;
throw SystemError(err.str());
}
}
......@@ -108,7 +108,7 @@ void SMDBServer::step()
}
catch(Exception& ex)
{
dlog[Debug::CRIT] << myname << "(step): (hb) " << ex << std::endl;
dlog.crit() << myname << "(step): (hb) " << ex << std::endl;
}
}
}
......@@ -132,14 +132,14 @@ void SMDBServer::initDB( DBInterface *db )
xmlNode* snode = conf->getXMLSensorsSection();
if(!snode)
{
dlog[Debug::CRIT] << myname << ": section <sensors> not found.." << endl;
dlog.crit() << myname << ": section <sensors> not found.." << endl;
return;
}
UniXML_iterator it(snode);
if( !it.goChildren() )
{
dlog[Debug::CRIT] << myname << ": section <sensors> empty?!.." << endl;
dlog.crit() << myname << ": section <sensors> empty?!.." << endl;
return;
}
......@@ -156,18 +156,18 @@ void SMDBServer::initDB( DBInterface *db )
if( !writeToBase("INSERT IGNORE INTO ObjectsMap(name,rep_name,id,msg)"+data.str()) )
{
dlog[Debug::CRIT] << myname << "(insert) ObjectsMap msg error: "<< db->error() << std::endl;
dlog.crit() << myname << "(insert) ObjectsMap msg error: "<< db->error() << std::endl;
db->freeResult();
}
}
}
catch( Exception& ex )
{
dlog[Debug::CRIT] << myname << "(filling ObjectsMap): " << ex << std::endl;
dlog.crit() << myname << "(filling ObjectsMap): " << ex << std::endl;
}
catch( ... )
{
dlog[Debug::CRIT] << myname << "(filling ObjectsMap): catch ..." << std::endl;
dlog.crit() << myname << "(filling ObjectsMap): catch ..." << std::endl;
}
}
//--------------------------------------------------------------------------------
......@@ -198,7 +198,7 @@ SMDBServer* SMDBServer::init_smdbserver( int argc, const char* const* argv,
return 0;
}
dlog[Debug::INFO] << "(SMDBServer): name = " << name << "(" << ID << ")" << endl;
dlog.info() << "(SMDBServer): name = " << name << "(" << ID << ")" << endl;
return new SMDBServer(ID,icID,ic,prefix);
}
// -----------------------------------------------------------------------------
......@@ -35,7 +35,7 @@ int main( int argc, const char** argv )
std::ostringstream logname;
string dir(conf->getLogDir());
logname << dir << logfilename;
unideb.logFile( logname.str() );
ulog.logFile( logname.str() );
dlog.logFile( logname.str() );
ObjectId shmID = DefaultObjectId;
......@@ -54,7 +54,7 @@ int main( int argc, const char** argv )
SMDBServer* db = SMDBServer::init_smdbserver(argc,argv,shmID);
if( !db )
{
dlog[Debug::CRIT] << "(smdbserver): init не прошёл..." << endl;
dlog.crit() << "(smdbserver): init не прошёл..." << endl;
return 1;
}
......@@ -64,8 +64,8 @@ int main( int argc, const char** argv )
SystemMessage sm(SystemMessage::StartUp);
act.broadcast( sm.transport_msg() );
unideb(Debug::ANY) << "\n\n\n";
unideb[Debug::ANY] << "(main): -------------- SMDBServer START -------------------------\n\n";
ulog.ebug::ANY) << "\n\n\n";
ulog.ebug::ANY] << "(main): -------------- SMDBServer START -------------------------\n\n";
dlog(Debug::ANY) << "\n\n\n";
dlog[Debug::ANY] << "(main): -------------- SMDBServer START -------------------------\n\n";
act.run(false);
......@@ -73,11 +73,11 @@ int main( int argc, const char** argv )
}
catch( Exception& ex )
{
dlog[Debug::CRIT] << "(smdbserver): " << ex << std::endl;
dlog.crit() << "(smdbserver): " << ex << std::endl;
}
catch(...)
{
dlog[Debug::CRIT] << "(smdbserver): catch ..." << std::endl;
dlog.crit() << "(smdbserver): catch ..." << std::endl;
}
return 1;
......
......@@ -25,7 +25,7 @@ int main(int argc, const char **argv)
conf->initDebug(dlog,"dlog");
string logfilename = conf->getArgParam("--logfile", "smemory.log");
string logname( conf->getLogDir() + logfilename );
unideb.logFile( logname );
ulog.logFile( logname );
dlog.logFile( logname );
SharedMemory* shm = SharedMemory::init_smemory(argc, argv);
......@@ -44,19 +44,19 @@ int main(int argc, const char **argv)
}
catch( SystemError& err )
{
unideb[Debug::CRIT] << "(smemory): " << err << endl;
ulog.crit() << "(smemory): " << err << endl;
}
catch( Exception& ex )
{
unideb[Debug::CRIT] << "(smemory): " << ex << endl;
ulog.crit() << "(smemory): " << ex << endl;
}
catch( std::exception& e )
{
unideb[Debug::CRIT] << "(smemory): " << e.what() << endl;
ulog.crit() << "(smemory): " << e.what() << endl;
}
catch(...)
{
unideb[Debug::CRIT] << "(smemory): catch(...)" << endl;
ulog.crit() << "(smemory): catch(...)" << endl;
}
return 1;
......
......@@ -52,7 +52,7 @@ int main( int argc, const char **argv )
string logfilename = conf->getArgParam("--logfile", "smemory-plus.log");
string logname( conf->getLogDir() + logfilename );
UniSetExtensions::dlog.logFile( logname );
unideb.logFile( logname );
ulog.logFile( logname );
conf->initDebug(UniSetExtensions::dlog,"dlog");
ObjectsActivator act;
......@@ -79,8 +79,8 @@ int main( int argc, const char **argv )
p << "io";
if( i > 0 ) p << i;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "(smemory-plus): add IOControl(" << p.str() << ")" << endl;
if( dlog.is_info() )
dlog.info() << "(smemory-plus): add IOControl(" << p.str() << ")" << endl;
IOControl* ic = IOControl::init_iocontrol(argc,argv,shm->getId(),shm,p.str());
if( ic == NULL )
......@@ -108,8 +108,8 @@ int main( int argc, const char **argv )
p << "rtu";
if( i > 0 ) p << i;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "(smemory-plus): add RTUExchange(" << p.str() << ")" << endl;
if( dlog.is_info() )
dlog.info() << "(smemory-plus): add RTUExchange(" << p.str() << ")" << endl;
RTUExchange* rtu = RTUExchange::init_rtuexchange(argc,argv,shm->getId(),shm,p.str());
if( rtu == NULL )
......@@ -131,9 +131,9 @@ int main( int argc, const char **argv )
stringstream p;
p << "mbs";
if( i > 0 ) p << i;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "(smemory-plus): add MBSlave(" << p.str() << ")" << endl;
if( dlog.is_info() )
dlog.info() << "(smemory-plus): add MBSlave(" << p.str() << ")" << endl;
MBSlave* mbs = MBSlave::init_mbslave(argc,argv,shm->getId(),shm,p.str());
if( mbs == NULL )
......@@ -158,8 +158,8 @@ int main( int argc, const char **argv )
p << "mbtcp";
if( i > 0 ) p << i;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "(smemory-plus): add MBTCPMaster(" << p.str() << ")" << endl;
if( dlog.is_info() )
dlog.info() << "(smemory-plus): add MBTCPMaster(" << p.str() << ")" << endl;
MBTCPMaster* mbm1 = MBTCPMaster::init_mbmaster(argc,argv,shm->getId(),shm,p.str());
if( mbm1 == NULL )
......@@ -176,8 +176,8 @@ int main( int argc, const char **argv )
if( unet == NULL )
return 1;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "(smemory-plus): add UNetExchnage.." << endl;
if( dlog.is_info() )
dlog.info() << "(smemory-plus): add UNetExchnage.." << endl;
act.addObject(static_cast<class UniSetObject*>(unet));
}
......@@ -198,15 +198,15 @@ int main( int argc, const char **argv )
}
catch(Exception& ex)
{
unideb[Debug::CRIT] << "(smemory-plus): " << ex << endl;
ulog.crit() << "(smemory-plus): " << ex << endl;
}
catch( CORBA::SystemException& ex )
{
unideb[Debug::CRIT] << "(smemory-plus): " << ex.NP_minorString() << endl;
ulog.crit() << "(smemory-plus): " << ex.NP_minorString() << endl;
}
catch(...)
{
unideb[Debug::CRIT] << "(smemory-plus): catch(...)" << endl;
ulog.crit() << "(smemory-plus): catch(...)" << endl;
}
on_sigchild(SIGTERM);
......
......@@ -64,14 +64,14 @@ a_cache_init_ok(false)
{
ostringstream s;
s << myname << ": " << e.what();
dlog[Debug::CRIT] << s.str() << std::endl;
dlog.crit() << s.str() << std::endl;
throw SystemError(s.str());
}
catch( ... )
{
ostringstream s;
s << myname << ": catch...";
dlog[Debug::CRIT] << s.str() << std::endl;
dlog.crit() << s.str() << std::endl;
throw SystemError(s.str());
}
......@@ -177,11 +177,11 @@ void UNetReceiver::update()
}
catch( UniSetTypes::Exception& ex)
{
dlog[Debug::CRIT] << myname << "(update): " << ex << std::endl;
dlog.crit() << myname << "(update): " << ex << std::endl;
}
catch(...)
{
dlog[Debug::CRIT] << myname << "(update): catch ..." << std::endl;
dlog.crit() << myname << "(update): catch ..." << std::endl;
}
if( sidRespond!=DefaultObjectId )
......@@ -193,7 +193,7 @@ void UNetReceiver::update()
}
catch(Exception& ex)
{
dlog[Debug::CRIT] << myname << "(step): (respond) " << ex << std::endl;
dlog.crit() << myname << "(step): (respond) " << ex << std::endl;
}
}
......@@ -205,7 +205,7 @@ void UNetReceiver::update()
}
catch(Exception& ex)
{
dlog[Debug::CRIT] << myname << "(step): (lostPackets) " << ex << std::endl;
dlog.crit() << myname << "(step): (lostPackets) " << ex << std::endl;
}
}
......@@ -286,7 +286,7 @@ void UNetReceiver::real_update()
ItemInfo& ii(d_icache[i]);
if( ii.id != id )
{
dlog[Debug::WARN] << myname << "(update): reinit cache for sid=" << id << endl;
dlog.warn() << myname << "(update): reinit cache for sid=" << id << endl;
ii.id = id;
shm->initIterator(ii.ioit);
}
......@@ -302,11 +302,11 @@ void UNetReceiver::real_update()
}
catch( UniSetTypes::Exception& ex)
{
dlog[Debug::CRIT] << myname << "(update): " << ex << std::endl;
dlog.crit() << myname << "(update): " << ex << std::endl;
}
catch(...)
{
dlog[Debug::CRIT] << myname << "(update): catch ..." << std::endl;
dlog.crit() << myname << "(update): catch ..." << std::endl;
}
}
......@@ -319,7 +319,7 @@ void UNetReceiver::real_update()
ItemInfo& ii(a_icache[i]);
if( ii.id != d.id )
{
dlog[Debug::WARN] << myname << "(update): reinit cache for sid=" << d.id << endl;
dlog.warn() << myname << "(update): reinit cache for sid=" << d.id << endl;
ii.id = d.id;
shm->initIterator(ii.ioit);
}
......@@ -335,11 +335,11 @@ void UNetReceiver::real_update()
}
catch( UniSetTypes::Exception& ex)
{
dlog[Debug::CRIT] << myname << "(update): " << ex << std::endl;
dlog.crit() << myname << "(update): " << ex << std::endl;
}
catch(...)
{
dlog[Debug::CRIT] << myname << "(update): catch ..." << std::endl;
dlog.crit() << myname << "(update): catch ..." << std::endl;
}
}
}
......@@ -356,8 +356,8 @@ void UNetReceiver::stop()
// -----------------------------------------------------------------------------
void UNetReceiver::receive()
{
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << myname << ": ******************* receive start" << endl;
if( dlog.is_info() )
dlog.info() << myname << ": ******************* receive start" << endl;
{
uniset_rwmutex_wrlock l(tmMutex);
......@@ -377,18 +377,18 @@ void UNetReceiver::receive()
}
catch( UniSetTypes::Exception& ex)
{
if( dlog.debugging(Debug::WARN) )
dlog[Debug::WARN] << myname << "(receive): " << ex << std::endl;
if( dlog.is_warn() )
dlog.warn() << myname << "(receive): " << ex << std::endl;
}
catch( std::exception& e )
{
if( dlog.debugging(Debug::WARN) )
dlog[Debug::WARN] << myname << "(receive): " << e.what()<< std::endl;
if( dlog.is_warn() )
dlog.warn() << myname << "(receive): " << e.what()<< std::endl;
}
catch(...)
{
if( dlog.debugging(Debug::WARN) )
dlog[Debug::WARN] << myname << "(receive): catch ..." << std::endl;
if( dlog.is_warn() )
dlog.warn() << myname << "(receive): catch ..." << std::endl;
}
// делаем через промежуточную переменную
......@@ -410,8 +410,8 @@ void UNetReceiver::receive()
msleep(recvpause);
}
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << myname << ": ************* receive FINISH **********" << endl;
if( dlog.is_info() )
dlog.info() << myname << ": ************* receive FINISH **********" << endl;
}
// -----------------------------------------------------------------------------
bool UNetReceiver::recv()
......@@ -424,7 +424,7 @@ bool UNetReceiver::recv()
size_t sz = UniSetUDP::UDPMessage::getMessage(pack,r_buf);
if( sz == 0 )
{
dlog[Debug::CRIT] << myname << "(receive): FAILED RECEIVE DATA ret=" << ret << endl;
dlog.crit() << myname << "(receive): FAILED RECEIVE DATA ret=" << ret << endl;
return false;
}
......@@ -439,7 +439,7 @@ bool UNetReceiver::recv()
// Обычно "кольцевой". Т.е. если не успели обработать и "вынуть" из буфера информацию.. он будет переписан новыми данными
if( waitClean )
{
dlog[Debug::CRIT] << myname << "(receive): reset qtmp.." << endl;
dlog.crit() << myname << "(receive): reset qtmp.." << endl;
while( !qtmp.empty() )
qtmp.pop();
}
......@@ -510,7 +510,7 @@ void UNetReceiver::initDCache( UniSetUDP::UDPMessage& pack, bool force )
if( !force && pack.dcount == d_icache.size() )
return;
dlog[Debug::INFO] << myname << ": init icache.." << endl;
dlog.info() << myname << ": init icache.." << endl;
d_cache_init_ok = true;
d_icache.resize(pack.dcount);
......@@ -532,7 +532,7 @@ void UNetReceiver::initACache( UniSetUDP::UDPMessage& pack, bool force )
if( !force && pack.acount == a_icache.size() )
return;
dlog[Debug::INFO] << myname << ": init icache.." << endl;
dlog.info() << myname << ": init icache.." << endl;
a_cache_init_ok = true;
a_icache.resize(pack.acount);
......
......@@ -31,11 +31,11 @@ s_thr(0)
// определяем фильтр
// s_field = conf->getArgParam("--udp-filter-field");
// s_fvalue = conf->getArgParam("--udp-filter-value");
dlog[Debug::INFO] << myname << "(init): read filter-field='" << s_field
dlog.info() << myname << "(init): read filter-field='" << s_field
<< "' filter-value='" << s_fvalue << "'" << endl;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "(UNetSender): UDP set to " << s_host << ":" << port << endl;
if( dlog.is_info() )
dlog.info() << "(UNetSender): UDP set to " << s_host << ":" << port << endl;
ost::Thread::setException(ost::Thread::throwException);
try
......@@ -47,14 +47,14 @@ s_thr(0)
{
ostringstream s;
s << myname << ": " << e.what();
dlog[Debug::CRIT] << s.str() << std::endl;
dlog.crit() << s.str() << std::endl;
throw SystemError(s.str());
}
catch( ... )
{
ostringstream s;
s << myname << ": catch...";
dlog[Debug::CRIT] << s.str() << std::endl;
dlog.crit() << s.str() << std::endl;
throw SystemError(s.str());
}
......@@ -65,7 +65,7 @@ s_thr(0)
{
readConfiguration();
dlist.resize(maxItem);
dlog[Debug::INFO] << myname << "(init): dlist size = " << dlist.size() << endl;
dlog.info() << myname << "(init): dlist size = " << dlist.size() << endl;
}
else
ic->addReadItem( sigc::mem_fun(this,&UNetSender::readItem) );
......@@ -130,7 +130,7 @@ void UNetSender::updateItem( DMap::iterator& it, long value )
void UNetSender::send()
{
dlist.resize(maxItem);
dlog[Debug::INFO] << myname << "(send): dlist size = " << dlist.size() << endl;
dlog.info() << myname << "(send): dlist size = " << dlist.size() << endl;
/*
ost::IPV4Broadcast h = s_host.c_str();
try
......@@ -141,7 +141,7 @@ void UNetSender::send()
{
ostringstream s;
s << e.getString() << ": " << e.getSystemErrorString();
dlog[Debug::CRIT] << myname << "(poll): " << s.str() << endl;
dlog.crit() << myname << "(poll): " << s.str() << endl;
throw SystemError(s.str());
}
*/
......@@ -156,25 +156,25 @@ void UNetSender::send()
}
catch( ost::SockException& e )
{
dlog[Debug::WARN] << myname << "(send): " << e.getString() << endl;
dlog.warn() << myname << "(send): " << e.getString() << endl;
}
catch( UniSetTypes::Exception& ex)
{
dlog[Debug::WARN] << myname << "(send): " << ex << std::endl;
dlog.warn() << myname << "(send): " << ex << std::endl;
}
catch( std::exception& e )
{
dlog[Debug::WARN] << myname << "(send): " << e.what() << std::endl;
dlog.warn() << myname << "(send): " << e.what() << std::endl;
}
catch(...)
{
dlog[Debug::WARN] << myname << "(send): catch ..." << std::endl;
}
dlog.warn() << myname << "(send): catch ..." << std::endl;
}
msleep(sendpause);
}
dlog[Debug::INFO] << "************* execute FINISH **********" << endl;
dlog.info() << "************* execute FINISH **********" << endl;
}
// -----------------------------------------------------------------------------
void UNetSender::real_send()
......@@ -191,7 +191,7 @@ void UNetSender::real_send()
mypack.transport_msg(s_msg);
size_t ret = udp->send( (char*)s_msg.data, s_msg.len );
if( ret < s_msg.len )
dlog[Debug::CRIT] << myname << "(real_send): FAILED ret=" << ret << " < sizeof=" << s_msg.len << endl;
dlog.crit() << myname << "(real_send): FAILED ret=" << ret << " < sizeof=" << s_msg.len << endl;
}
// -----------------------------------------------------------------------------
void UNetSender::stop()
......@@ -259,7 +259,7 @@ bool UNetSender::initItem( UniXML_iterator& it )
if( sid == DefaultObjectId )
{
if( dlog )
dlog[Debug::CRIT] << myname << "(readItem): ID not found for "
dlog.crit() << myname << "(readItem): ID not found for "
<< sname << endl;
return false;
}
......@@ -269,7 +269,7 @@ bool UNetSender::initItem( UniXML_iterator& it )
if( p.iotype == UniversalIO::UnknownIOType )
{
dlog[Debug::CRIT] << myname << "(readItem): Unknown iotype for sid=" << sid << endl;
dlog.crit() << myname << "(readItem): Unknown iotype for sid=" << sid << endl;
return false;
}
......@@ -280,8 +280,8 @@ bool UNetSender::initItem( UniXML_iterator& it )
p.pack_ind = mypack.addDData(sid,0);
if ( p.pack_ind >= UniSetUDP::MaxDCount )
{
dlog[Debug::CRIT] << myname
<< "(readItem): OVERFLOW! MAX UDP DIGITAL DATA LIMIT! max="
dlog.crit() << myname
<< "(readItem): OVERFLOW! MAX UDP DIGITAL DATA LIMIT! max="
<< UniSetUDP::MaxDCount << endl;
raise(SIGTERM);
......@@ -293,8 +293,8 @@ bool UNetSender::initItem( UniXML_iterator& it )
p.pack_ind = mypack.addAData(sid,0);
if ( p.pack_ind >= UniSetUDP::MaxACount )
{
dlog[Debug::CRIT] << myname
<< "(readItem): OVERFLOW! MAX UDP ANALOG DATA LIMIT! max="
dlog.crit() << myname
<< "(readItem): OVERFLOW! MAX UDP ANALOG DATA LIMIT! max="
<< UniSetUDP::MaxACount << endl;
raise(SIGTERM);
return false;
......@@ -307,8 +307,8 @@ bool UNetSender::initItem( UniXML_iterator& it )
dlist[maxItem] = p;
maxItem++;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << myname << "(initItem): add " << p << endl;
if( dlog.is_info() )
dlog.info() << myname << "(initItem): add " << p << endl;
return true;
}
......
......@@ -32,7 +32,7 @@ int main( int argc, const char** argv )
std::ostringstream logname;
string dir(conf->getLogDir());
logname << dir << logfilename;
unideb.logFile( logname.str() );
ulog.logFile( logname.str() );
UniSetExtensions::dlog.logFile( logname.str() );
conf->initDebug(UniSetExtensions::dlog,"dlog");
......@@ -52,7 +52,7 @@ int main( int argc, const char** argv )
UNetExchange* unet = UNetExchange::init_unetexchange(argc,argv,shmID);
if( !unet )
{
dlog[Debug::CRIT] << "(unetexchange): init failed.." << endl;
dlog.crit() << "(unetexchange): init failed.." << endl;
return 1;
}
......@@ -62,21 +62,21 @@ int main( int argc, const char** argv )
SystemMessage sm(SystemMessage::StartUp);
act.broadcast( sm.transport_msg() );
unideb(Debug::ANY) << "\n\n\n";
unideb[Debug::ANY] << "(main): -------------- UDPRecevier START -------------------------\n\n";
dlog(Debug::ANY) << "\n\n\n";
dlog[Debug::ANY] << "(main): -------------- UDPReceiver START -------------------------\n\n";
ulog << "\n\n\n";
ulog << "(main): -------------- UDPRecevier START -------------------------\n\n";
dlog << "\n\n\n";
dlog << "(main): -------------- UDPReceiver START -------------------------\n\n";
act.run(false);
while( waitpid(-1, 0, 0) > 0 );
}
catch( Exception& ex )
{
dlog[Debug::CRIT] << "(unetexchange): " << ex << std::endl;
dlog.crit() << "(unetexchange): " << ex << std::endl;
}
catch(...)
{
dlog[Debug::CRIT] << "(unetexchange): catch ..." << std::endl;
dlog.crit() << "(unetexchange): catch ..." << std::endl;
}
while( waitpid(-1, 0, 0) > 0 );
......
......@@ -36,18 +36,18 @@ smReadyTimeout(15000)
s_field = conf->getArgParam("--" + prefix + "-filter-field");
s_fvalue = conf->getArgParam("--" + prefix + "-filter-value");
dlog[Debug::INFO] << myname << "(init): read fileter-field='" << s_field
dlog.info() << myname << "(init): read fileter-field='" << s_field
<< "' filter-value='" << s_fvalue << "'" << endl;
polltime = conf->getArgInt("--" + prefix + "-polltime",it.getProp("polltime"));
if( polltime <= 0 )
polltime = 200;
dlog[Debug::INFO] << myname << "(init): polltime=" << polltime << endl;
dlog.info() << myname << "(init): polltime=" << polltime << endl;
int updatetime = conf->getArgInt("--" + prefix + "-updatetime",it.getProp("updatetime"));
if( updatetime <= 0 )
updatetime = 200;
dlog[Debug::INFO] << myname << "(init): updatetime=" << polltime << endl;
dlog.info() << myname << "(init): updatetime=" << polltime << endl;
ptUpdate.setTiming(updatetime);
......@@ -57,7 +57,7 @@ smReadyTimeout(15000)
else if( smReadyTimeout < 0 )
smReadyTimeout = UniSetTimer::WaitUpTime;
dlog[Debug::INFO] << myname << "(init): smReadyTimeout=" << smReadyTimeout << endl;
dlog.info() << myname << "(init): smReadyTimeout=" << smReadyTimeout << endl;
if( it.goChildren() )
{
......@@ -97,7 +97,7 @@ smReadyTimeout(15000)
ni.node = node;
ni.sidConnection = conf->getSensorID(it.getProp("sid_connection"));
dlog[Debug::INFO] << myname << ": add point " << n << ":" << n1 << endl;
dlog.info() << myname << ": add point " << n << ":" << n1 << endl;
nlst.push_back(ni);
}
}
......@@ -127,7 +127,7 @@ void UniExchange::execute()
err << myname << "(execute): Не дождались готовности SharedMemory к работе в течение "
<< smReadyTimeout << " мсек";
unideb[Debug::CRIT] << err.str() << endl;
ulog.crit() << err.str() << endl;
throw SystemError(err.str());
}
......@@ -150,23 +150,23 @@ void UniExchange::execute()
bool ok = false;
try
{
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << myname << ": connect to id=" << it->id << " node=" << it->node << endl;
if( dlog.is_info() )
dlog.info() << myname << ": connect to id=" << it->id << " node=" << it->node << endl;
IOController_i::ShortMapSeq_var sseq = ui.getSensors( it->id, it->node );
ok = true;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << myname << " update sensors from id=" << it->id << " node=" << it->node << endl;
if( dlog.is_info() )
dlog.info() << myname << " update sensors from id=" << it->id << " node=" << it->node << endl;
it->update(sseq,shm);
}
catch( Exception& ex )
{
dlog[Debug::INFO] << myname << "(execute): " << ex << endl;
dlog.info() << myname << "(execute): " << ex << endl;
}
catch( ... )
{
dlog[Debug::INFO] << myname << "(execute): catch ..." << endl;
dlog.info() << myname << "(execute): catch ..." << endl;
}
if( it->sidConnection != DefaultObjectId )
......@@ -177,15 +177,15 @@ void UniExchange::execute()
}
catch(...)
{
if( dlog.debugging(Debug::CRIT) )
dlog[Debug::CRIT]<< myname << "(execute): sensor not avalible "
if( dlog.is_crit() )
dlog.crit()<< myname << "(execute): sensor not avalible "
<< conf->oind->getNameById( it->sidConnection)
<< endl;
}
}
if( !ok && dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << myname << ": ****** cannot connect with node=" << it->node << endl;
if( !ok && dlog.is_info() )
dlog.info() << myname << ": ****** cannot connect with node=" << it->node << endl;
}
if( ptUpdate.checkTime() )
......@@ -234,11 +234,11 @@ void UniExchange::NetNodeInfo::update( IOController_i::ShortMapSeq_var& map, SMI
}
catch( Exception& ex )
{
dlog[Debug::INFO] << "(update): " << ex << endl;
dlog.info() << "(update): " << ex << endl;
}
catch( ... )
{
dlog[Debug::INFO] << "(update): catch ..." << endl;
dlog.info() << "(update): catch ..." << endl;
}
}
}
......@@ -278,11 +278,11 @@ void UniExchange::updateLocalData()
}
catch( Exception& ex )
{
dlog[Debug::WARN] << "(update): " << ex << endl;
dlog.warn() << "(update): " << ex << endl;
}
catch( ... )
{
dlog[Debug::WARN] << "(update): catch ..." << endl;
dlog.warn() << "(update): catch ..." << endl;
}
}
......@@ -444,7 +444,7 @@ bool UniExchange::initItem( UniXML_iterator& it )
if( i.id == DefaultObjectId )
{
if( dlog )
dlog[Debug::CRIT] << myname << "(initItem): Unknown ID for "
dlog.crit() << myname << "(initItem): Unknown ID for "
<< it.getProp("name") << endl;
return false;
}
......@@ -453,7 +453,7 @@ bool UniExchange::initItem( UniXML_iterator& it )
if( i.type == UniversalIO::UnknownIOType )
{
if( dlog )
dlog[Debug::CRIT] << myname << "(initItem): Unknown iotype= "
dlog.crit() << myname << "(initItem): Unknown iotype= "
<< it.getProp("iotype") << " for " << it.getProp("name") << endl;
return false;
}
......
......@@ -26,7 +26,7 @@ int main(int argc, const char **argv)
conf->initDebug(dlog,"dlog");
string logfilename = conf->getArgParam("--logfile", "smemory.log");
string logname( conf->getLogDir() + logfilename );
unideb.logFile( logname );
ulog.logFile( logname );
dlog.logFile( logname );
ObjectId shmID = DefaultObjectId;
......@@ -58,15 +58,15 @@ int main(int argc, const char **argv)
}
catch(SystemError& err)
{
unideb[Debug::CRIT] << "(uninetwork): " << err << endl;
ulog.crit() << "(uninetwork): " << err << endl;
}
catch(Exception& ex)
{
unideb[Debug::CRIT] << "(uninetwork): " << ex << endl;
ulog.crit() << "(uninetwork): " << ex << endl;
}
catch(...)
{
unideb[Debug::CRIT] << "(uninetwork): catch(...)" << endl;
ulog.crit() << "(uninetwork): catch(...)" << endl;
}
while( waitpid(-1, 0, 0) > 0 );
......
......@@ -7,7 +7,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/
// --------------------------------------------------------------------------
// generate timestamp: 2013-12-15+04:00
// generate timestamp: 2013-12-17+04:00
// -----------------------------------------------------------------------------
#ifndef UObject_SK_H_
#define UObject_SK_H_
......
......@@ -24,7 +24,7 @@ namespace UniSetExtensions
{
ostringstream err;
err << ": Unknown ID for '" << sname << "'" << endl;
dlog[Debug::CRIT] << err.str() << endl;
dlog.crit() << err.str() << endl;
throw SystemError(err.str());
}
......@@ -53,11 +53,11 @@ namespace UniSetExtensions
if( heartBeatTime <= 0 )
{
heartBeatTime = 0;
dlog[Debug::WARN] << "(getHeartBeatTime): механизм 'HEARTBEAT' ОТКЛЮЧЁН!" << endl;
dlog.warn() << "(getHeartBeatTime): механизм 'HEARTBEAT' ОТКЛЮЧЁН!" << endl;
}
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "(getHeartBeatTime): heartbeat time = " << heartBeatTime << endl;
if( dlog.is_info() )
dlog.info() << "(getHeartBeatTime): heartbeat time = " << heartBeatTime << endl;
return heartBeatTime;
}
......@@ -114,7 +114,7 @@ namespace UniSetExtensions
{
ostringstream err;
err << "(buildCalibrationDiagram): НЕ НАЙДЕН корневой узел для калибровочных диаграмм";
dlog[Debug::CRIT] << err.str() << endl;
dlog.crit() << err.str() << endl;
throw SystemError( err.str());
}
......@@ -123,7 +123,7 @@ namespace UniSetExtensions
{
ostringstream err;
err << "(buildCalibrationDiagram): НЕ НАЙДЕНА калибровочная диаграмма '" << dname << "'";
dlog[Debug::CRIT] << err.str() << endl;
dlog.crit() << err.str() << endl;
throw SystemError( err.str());
}
......
......@@ -390,8 +390,8 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
if( sid == DefaultObjectId )
{
if( dlog )
dlog[Debug::CRIT] << myname << "(readItem): (-1) Не удалось получить ID для датчика: "
if( dlog && dlog->is_crit() )
dlog->crit() << myname << "(readItem): (-1) Не удалось получить ID для датчика: "
<< sname << endl;
return false;
}
......@@ -435,9 +435,9 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
}
else
{
if( dlog )
dlog[Debug::CRIT] << myname << "(IOBase::readItem): Unknown iofront='" << front_t << "'"
<< " for '" << sname << "'. Must be [ 01, 10 ]." << endl;
if( dlog && dlog->is_crit() )
dlog->crit() << myname << "(IOBase::readItem): Unknown iofront='" << front_t << "'"
<< " for '" << sname << "'. Must be [ 01, 10 ]." << endl;
return false;
}
}
......@@ -447,8 +447,8 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
b->stype = UniSetTypes::getIOType(it.getProp("iotype"));
if( b->stype == UniversalIO::UnknownIOType )
{
if( dlog )
dlog[Debug::CRIT] << myname << "(IOBase::readItem): неизвестный iotype=: "
if( dlog && dlog->is_crit() )
dlog->crit() << myname << "(IOBase::readItem): неизвестный iotype=: "
<< it.getProp("iotype") << " для " << sname << endl;
return false;
}
......@@ -534,8 +534,8 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
b->t_ai = conf->getSensorID(tai);
if( b->t_ai == DefaultObjectId )
{
if( dlog )
dlog[Debug::CRIT] << myname << "(IOBase::readItem): unknown ID for threshold_ai "
if( dlog && dlog->is_crit() )
dlog->crit() << myname << "(IOBase::readItem): unknown ID for threshold_ai "
<< tai << endl;
return false;
}
......@@ -548,7 +548,7 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
}
// else
// {
// dlog[Debug::CRIT] << myname << "(IOBase::readItem): неизвестный iotype=: " << stype << " для " << sname << endl;
// dlog.crit() << myname << "(IOBase::readItem): неизвестный iotype=: " << stype << " для " << sname << endl;
// return false;
// }
......
......@@ -51,24 +51,24 @@ using namespace UniSetTypes;
} \
catch( IOController_i::NameNotFound &ex ) \
{ \
unideb[Debug::WARN] << "(" << __STRING(fname) << "): " << ex.err << endl; \
ulog.warn() << "(" << __STRING(fname) << "): " << ex.err << endl; \
} \
catch( IOController_i::IOBadParam &ex ) \
{ \
unideb[Debug::WARN] << "(" << __STRING(fname) << "): " << ex.err << endl; \
ulog.warn() << "(" << __STRING(fname) << "): " << ex.err << endl; \
} \
catch( Exception& ex ) \
{ \
unideb[Debug::WARN] << "(" << __STRING(fname) << "): " << ex << endl; \
ulog.warn() << "(" << __STRING(fname) << "): " << ex << endl; \
} \
catch(CORBA::SystemException& ex) \
{ \
unideb[Debug::WARN] << "(" << __STRING(fname) << "): CORBA::SystemException: " \
ulog.warn() << "(" << __STRING(fname) << "): CORBA::SystemException: " \
<< ex.NP_minorString() << endl; \
} \
catch(...) \
{ \
unideb[Debug::WARN] << "(" << __STRING(fname) << "): catch ..." << endl; \
ulog.warn() << "(" << __STRING(fname) << "): catch ..." << endl; \
} \
\
oref = CORBA::Object::_nil(); \
......@@ -77,7 +77,7 @@ using namespace UniSetTypes;
#define CHECK_IC_PTR(fname) \
if( !ic ) \
{ \
unideb[Debug::WARN] << "(" << __STRING(fname) << "): function NOT DEFINED..." << endl; \
ulog.warn() << "(" << __STRING(fname) << "): function NOT DEFINED..." << endl; \
throw UniSetTypes::TimeOut(); \
} \
......
......@@ -11,7 +11,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/
// --------------------------------------------------------------------------
// generate timestamp: 2013-12-15+04:00
// generate timestamp: 2013-12-17+04:00
// -----------------------------------------------------------------------------
#include "Configuration.h"
#include "Exceptions.h"
......@@ -43,7 +43,7 @@ askPause(2000),
end_private(false)
{
unideb[Debug::CRIT] << "UObject: init failed!!!!!!!!!!!!!!!" << endl;
ulog.crit() << "UObject: init failed!!!!!!!!!!!!!!!" << endl;
throw Exception( string(myname+": init failed!!!") );
}
// -----------------------------------------------------------------------------
......@@ -170,23 +170,27 @@ bool UObject_SK::alarm( UniSetTypes::ObjectId _code, bool _state )
{
if( _code == UniSetTypes::DefaultObjectId )
{
unideb[Debug::CRIT] << getName()
<< "(alarm): попытка послать сообщение с DefaultObjectId"
<< endl;
if( ulog.is_crit() )
ulog.crit() << getName()
<< "(alarm): попытка послать сообщение с DefaultObjectId"
<< endl;
return false;
}
unideb[Debug::LEVEL1] << getName() << "(alarm): ";
if( _state )
unideb(Debug::LEVEL1) << "SEND ";
else
unideb(Debug::LEVEL1) << "RESET ";
unideb(Debug::LEVEL1) << endl;
if( ulog.is_level1() )
{
ulog.level1() << getName() << "(alarm): ";
if( _state )
ulog.level1(false) << "SEND ";
else
ulog.level1(false) << "RESET ";
ulog.level1(false) << endl;
}
if( ulog.is_level1() )
ulog.level1() << " not found MessgeOID?!!" << endl;
unideb[Debug::LEVEL1] << " not found MessgeOID?!!" << endl;
return false;
}
// -----------------------------------------------------------------------------
......@@ -256,10 +260,11 @@ void UObject_SK::sysCommand( SystemMessage* _sm )
switch( _sm->command )
{
case SystemMessage::WatchDog:
unideb << myname << "(sysCommand): WatchDog" << endl;
ulog << myname << "(sysCommand): WatchDog" << endl;
if( !active || !ptStartUpTimeout.checkTime() )
{
unideb[Debug::WARN] << myname << "(sysCommand): игнорируем WatchDog, потому-что только-что стартанули" << endl;
if( ulog.is_warn() )
ulog.warn() << myname << "(sysCommand): игнорируем WatchDog, потому-что только-что стартанули" << endl;
break;
}
case SystemMessage::StartUp:
......@@ -285,12 +290,12 @@ void UObject_SK::sysCommand( SystemMessage* _sm )
case SystemMessage::LogRotate:
{
// переоткрываем логи
unideb << myname << "(sysCommand): logRotate" << endl;
string fname = unideb.getLogFile();
ulog << myname << "(sysCommand): logRotate" << endl;
string fname( ulog.getLogFile() );
if( !fname.empty() )
{
unideb.logFile(fname.c_str());
unideb << myname << "(sysCommand): ***************** UNIDEB LOG ROTATE *****************" << endl;
ulog.logFile(fname.c_str());
ulog << myname << "(sysCommand): ***************** ulog LOG ROTATE *****************" << endl;
}
}
break;
......@@ -335,10 +340,10 @@ void UObject_SK::waitSM( int wait_msec, ObjectId _testID )
if( _testID == DefaultObjectId )
return;
if( unideb.debugging(Debug::INFO) )
if( ulog.is_info() )
{
unideb[Debug::INFO] << myname << "(waitSM): waiting SM ready "
ulog.info() << myname << "(waitSM): waiting SM ready "
<< wait_msec << " msec"
<< " testID=" << _testID << endl;
}
......@@ -350,7 +355,8 @@ void UObject_SK::waitSM( int wait_msec, ObjectId _testID )
<< "(waitSM): Не дождались готовности(exist) SharedMemory к работе в течение "
<< wait_msec << " мсек";
unideb[Debug::CRIT] << err.str() << endl;
if( ulog.is_crit() )
ulog.crit() << err.str() << endl;
terminate();
abort();
// kill(SIGTERM,getpid()); // прерываем (перезапускаем) процесс...
......@@ -404,16 +410,19 @@ void UObject_SK::callback()
}
catch( Exception& ex )
{
unideb[Debug::CRIT] << myname << "(execute): " << ex << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(execute): " << ex << endl;
}
catch(CORBA::SystemException& ex)
{
unideb[Debug::CRIT] << myname << "(execute): СORBA::SystemException: "
<< ex.NP_minorString() << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(execute): СORBA::SystemException: "
<< ex.NP_minorString() << endl;
}
catch(...)
{
unideb[Debug::CRIT] << myname << "(execute): catch ..." << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(execute): catch ..." << endl;
}
if( !active )
......@@ -450,14 +459,14 @@ long UObject_SK::getValue( UniSetTypes::ObjectId _sid )
try
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(getValue): Обращение к неизвестному ДИСКРЕТНОМУ датчику sid="
if( ulog.is_crit() )
ulog.crit() << myname << "(getValue): Обращение к неизвестному датчику sid="
<< _sid << endl;
}
catch(Exception& ex)
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(getValue): " << ex << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(getValue): " << ex << endl;
throw;
}
......@@ -476,8 +485,8 @@ void UObject_SK::preAskSensors( UniversalIO::UIOCommand _cmd )
break;
}
if( !activated )
unideb[Debug::CRIT] << myname
if( !activated && ulog.is_crit() )
ulog.crit() << myname
<< "(preAskSensors): ************* don`t activated?! ************" << endl;
for( ;; )
......@@ -489,15 +498,18 @@ void UObject_SK::preAskSensors( UniversalIO::UIOCommand _cmd )
}
catch(SystemError& err)
{
unideb[Debug::CRIT] << myname << "(preAskSensors): " << err << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(preAskSensors): " << err << endl;
}
catch(Exception& ex)
{
unideb[Debug::CRIT] << myname << "(preAskSensors): " << ex << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(preAskSensors): " << ex << endl;
}
catch(...)
{
unideb[Debug::CRIT] << myname << "(preAskSensors): catch(...)" << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(preAskSensors): catch(...)" << endl;
}
msleep(askPause);
}
......
......@@ -26,7 +26,7 @@ int main(int argc, const char **argv)
conf->initDebug(dlog,"dlog");
string logfilename = conf->getArgParam("--logfile", "smemory.log");
string logname( conf->getLogDir() + logfilename );
unideb.logFile( logname );
ulog.logFile( logname );
dlog.logFile( logname );
SharedMemory* shm = SharedMemory::init_smemory(argc, argv);
......@@ -49,19 +49,19 @@ int main(int argc, const char **argv)
}
catch( SystemError& err )
{
unideb[Debug::CRIT] << "(smemory): " << err << endl;
ulog.crit() << "(smemory): " << err << endl;
}
catch( Exception& ex )
{
unideb[Debug::CRIT] << "(smemory): " << ex << endl;
ulog.crit() << "(smemory): " << ex << endl;
}
catch( std::exception& e )
{
unideb[Debug::CRIT] << "(smemory): " << e.what() << endl;
ulog.crit() << "(smemory): " << e.what() << endl;
}
catch(...)
{
unideb[Debug::CRIT] << "(smemory): catch(...)" << endl;
ulog.crit() << "(smemory): catch(...)" << endl;
}
return 1;
......
......@@ -240,7 +240,7 @@ namespace UniSetTypes
extern Configuration* conf;
/*! Глобальный объект для вывода логов */
extern DebugStream unideb;
extern DebugStream ulog;
// Инициализация UniSetTypes::conf.
......
......@@ -108,6 +108,6 @@ void operator|=(Debug::type & d1, Debug::type d2)
#include "DebugStream.h"
std::ostream & operator<<(std::ostream & o, Debug::type t);
//extern DebugStream unideb;
//extern DebugStream ulog;
#endif
......@@ -58,7 +58,7 @@ struct Debug {
If you want to have debug output from time critical code you should
use this construct:
if (debug.debugging(Debug::INFO)) {
if (debug..is_info()) {
debug << "...debug output...\n";
}
......@@ -117,12 +117,8 @@ public:
inline std::string getLogFile(){ return fname; }
/// Returns true if t is part of the current debug level.
bool debugging(Debug::type t = Debug::ANY) const
{
if (dt & t) return true;
return false;
}
inline bool debugging(Debug::type t = Debug::ANY) const
{ return (dt & t); }
/** Returns the no-op stream if t is not part of the
current debug level otherwise the real debug stream
......@@ -146,26 +142,52 @@ public:
Вывод продолжения логов (без даты и времени)
*/
inline std::ostream& to_end(Debug::type t)
{
return this->operator()(t);
}
{ return this->operator()(t); }
/**
Вывод продолжения логов (без даты и времени)
Вывод продолжения логов (без даты и времени) "log()"
*/
std::ostream& operator()(Debug::type t);
inline void showDateTime(bool s)
{
show_datetime = s;
}
std::ostream& print_date(Debug::type t, char brk='/');
std::ostream& print_time(Debug::type t, char brk=':');
std::ostream& print_datetime(Debug::type t);
{ show_datetime = s; }
// короткие функции (для удобства)
// log.level1() - вывод с датой и временем "date time [LEVEL] ...",
// если вывод даты и времени не выключен при помощи showDateTime(false)
// if( log.is_level1() ) - проверка включён ли лог.."
#define DMANIP(FNAME,LEVEL) \
inline std::ostream& FNAME( bool showdatetime=true ) \
{\
if( showdatetime )\
return operator[](Debug::LEVEL); \
return operator()(Debug::LEVEL); \
} \
\
inline bool is_##FNAME() \
{ return debugging(Debug::LEVEL); }
DMANIP(level1,LEVEL1)
DMANIP(level2,LEVEL2)
DMANIP(level3,LEVEL3)
DMANIP(level4,LEVEL4)
DMANIP(level5,LEVEL5)
DMANIP(level6,LEVEL6)
DMANIP(level7,LEVEL7)
DMANIP(level8,LEVEL8)
DMANIP(level9,LEVEL9)
DMANIP(info,INFO)
DMANIP(warn,WARN)
DMANIP(crit,CRIT)
DMANIP(repository,REPOSITORY)
DMANIP(system,SYSTEM)
DMANIP(exception,EXCEPTION)
#undef DMANIP
std::ostream& printDate(Debug::type t, char brk='/');
std::ostream& printTime(Debug::type t, char brk=':');
std::ostream& printDateTime(Debug::type t);
std::ostream& pos(int x, int y);
......
......@@ -105,7 +105,7 @@ class UniXML_iterator:
operator xmlNode*()
{
//unideb << "current\n";
//ulog.< "current\n";
return curNode;
}
......
......@@ -237,7 +237,7 @@ long UModbus::data2value( VTypes::VType vtype, ModbusRTU::ModbusData* data )
return true;
}
dlog[Debug::CRIT] << myname << "(initSMValue): IGNORE item: rnum=" << p->rnum
dlog.crit() << myname << "(initSMValue): IGNORE item: rnum=" << p->rnum
<< " > 1 ?!! for id=" << p->si.id << endl;
return false;
......
......@@ -127,7 +127,7 @@ mbErrCode ModbusRTUMaster::sendData( unsigned char* buf, int len )
}
catch( Exception& ex ) // SystemError
{
dlog[Debug::CRIT] << "(send): " << ex << endl;
dlog.crit() << "(send): " << ex << endl;
return erHardwareError;
}
......
......@@ -68,7 +68,7 @@ mbErrCode ModbusRTUSlave::receive( ModbusRTU::ModbusAddr addr, timeout_t timeout
if( !lck.lock_ok() )
{
if( dlog.debugging(Debug::CRIT) )
dlog[Debug::CRIT] << "(ModbusRTUSlave::receive): Don`t lock " << recvMutex << endl;
dlog.crit() << "(ModbusRTUSlave::receive): Don`t lock " << recvMutex << endl;
return erTimeOut;
}
......@@ -89,7 +89,7 @@ mbErrCode ModbusRTUSlave::receive( ModbusRTU::ModbusAddr addr, timeout_t timeout
printProcessingTime();
}
// dlog[Debug::WARN] << "(receive): " << mbErr2Str(res) << endl;
// dlog.warn() << "(receive): " << mbErr2Str(res) << endl;
// cerr << "**** (receive): " << mbErr2Str(res) << endl;
usleep(10000);
return res;
......@@ -151,7 +151,7 @@ mbErrCode ModbusRTUSlave::sendData( unsigned char* buf, int len )
}
catch( Exception& ex ) // SystemError
{
dlog[Debug::CRIT] << "(send): " << ex << endl;
dlog.crit() << "(send): " << ex << endl;
return erHardwareError;
}
......
......@@ -54,22 +54,22 @@ mbErrCode ModbusTCPMaster::query( ModbusAddr addr, ModbusMessage& msg,
{
if( iaddr.empty() )
{
if( dlog.debugging(Debug::WARN) )
dlog[Debug::WARN] << iaddr << "(ModbusTCPMaster::query): unknown ip address for server..." << endl;
if( dlog.is_warn() )
dlog.warn() << iaddr << "(ModbusTCPMaster::query): unknown ip address for server..." << endl;
return erTimeOut; // erHardwareError
}
if( !isConnection() )
{
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << iaddr << "(ModbusTCPMaster::query): no connection.. reconnnect..." << endl;
if( dlog.is_info() )
dlog.info() << iaddr << "(ModbusTCPMaster::query): no connection.. reconnnect..." << endl;
reconnect();
}
if( !isConnection() )
{
if( dlog.debugging(Debug::WARN) )
dlog[Debug::WARN] << iaddr << "(ModbusTCPMaster::query): not connected to server..." << endl;
if( dlog.is_warn() )
dlog.warn() << iaddr << "(ModbusTCPMaster::query): not connected to server..." << endl;
return erTimeOut;
}
......@@ -95,9 +95,9 @@ mbErrCode ModbusTCPMaster::query( ModbusAddr addr, ModbusMessage& msg,
mh.swapdata();
// send TCP header
if( dlog.debugging(Debug::INFO) )
if( dlog.is_info() )
{
dlog[Debug::INFO] << iaddr << "(ModbusTCPMaster::query): send tcp header(" << sizeof(mh) <<"): ";
dlog.info() << iaddr << "(ModbusTCPMaster::query): send tcp header(" << sizeof(mh) <<"): ";
mbPrintMessage( dlog, (ModbusByte*)(&mh), sizeof(mh));
dlog(Debug::INFO) << endl;
}
......@@ -114,20 +114,20 @@ mbErrCode ModbusTCPMaster::query( ModbusAddr addr, ModbusMessage& msg,
if( tcp->isPending(ost::Socket::pendingOutput,timeout) )
break;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "(ModbusTCPMaster::query): no write pending.. reconnnect.." << endl;
if( dlog.is_info() )
dlog.info() << "(ModbusTCPMaster::query): no write pending.. reconnnect.." << endl;
reconnect();
if( !isConnection() )
{
if( dlog.debugging(Debug::WARN) )
dlog[Debug::WARN] << "(ModbusTCPMaster::query): not connected to server..." << endl;
if( dlog.is_warn() )
dlog.warn() << "(ModbusTCPMaster::query): not connected to server..." << endl;
return erTimeOut;
}
cleanInputStream();
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "(ModbusTCPMaster::query): no write pending.. reconnnect OK" << endl;
if( dlog.is_info() )
dlog.info() << "(ModbusTCPMaster::query): no write pending.. reconnnect OK" << endl;
}
mh.swapdata();
......@@ -160,18 +160,18 @@ mbErrCode ModbusTCPMaster::query( ModbusAddr addr, ModbusMessage& msg,
*/
ModbusTCP::MBAPHeader rmh;
int ret = getNextData((unsigned char*)(&rmh),sizeof(rmh));
if( dlog.debugging(Debug::INFO) )
if( dlog.is_info() )
{
dlog[Debug::INFO] << "(ModbusTCPMaster::query): recv tcp header(" << ret << "): ";
dlog.info() << "(ModbusTCPMaster::query): recv tcp header(" << ret << "): ";
mbPrintMessage( dlog, (ModbusByte*)(&rmh), sizeof(rmh));
dlog(Debug::INFO) << endl;
dlog.info(false) << endl;
}
if( ret < (int)sizeof(rmh) )
{
ost::tpport_t port;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "(ModbusTCPMaster::query): ret=" << (int)ret
if( dlog.is_info() )
dlog.info() << "(ModbusTCPMaster::query): ret=" << (int)ret
<< " < rmh=" << (int)sizeof(rmh)
<< " err: " << tcp->getErrorNumber()
<< " perr: " << tcp->getPeer(&port)
......@@ -201,8 +201,8 @@ mbErrCode ModbusTCPMaster::query( ModbusAddr addr, ModbusMessage& msg,
if( force_disconnect )
{
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "(query): force disconnect.." << endl;
if( dlog.is_info() )
dlog.info() << "(query): force disconnect.." << endl;
disconnect();
}
......@@ -210,13 +210,13 @@ mbErrCode ModbusTCPMaster::query( ModbusAddr addr, ModbusMessage& msg,
return res;
}
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "(query): input pending timeout " << endl;
if( dlog.is_info() )
dlog.info() << "(query): input pending timeout " << endl;
if( force_disconnect )
{
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "(query): force disconnect.." << endl;
if( dlog.is_info() )
dlog.info() << "(query): force disconnect.." << endl;
// cleanInputStream();
disconnect();
......@@ -226,35 +226,35 @@ mbErrCode ModbusTCPMaster::query( ModbusAddr addr, ModbusMessage& msg,
}
catch( ModbusRTU::mbException& ex )
{
if( dlog.debugging(Debug::WARN) )
dlog[Debug::WARN] << "(query): " << ex << endl;
if( dlog.is_warn() )
dlog.warn() << "(query): " << ex << endl;
}
catch( SystemError& err )
{
if( dlog.debugging(Debug::WARN) )
dlog[Debug::WARN] << "(query): " << err << endl;
if( dlog.is_warn() )
dlog.warn() << "(query): " << err << endl;
}
catch( Exception& ex )
{
if( dlog.debugging(Debug::WARN) )
dlog[Debug::WARN] << "(query): " << ex << endl;
if( dlog.is_warn() )
dlog.warn() << "(query): " << ex << endl;
}
catch( ost::SockException& e )
{
if( dlog.debugging(Debug::WARN) )
dlog[Debug::WARN] << "(query): tcp error: " << e.getString() << endl;
if( dlog.is_warn() )
dlog.warn() << "(query): tcp error: " << e.getString() << endl;
return erTimeOut;
}
catch( std::exception& e )
{
if( dlog.debugging(Debug::WARN) )
dlog[Debug::CRIT] << "(query): " << e.what() << std::endl;
if( dlog.is_warn() )
dlog.crit() << "(query): " << e.what() << std::endl;
return erTimeOut;
}
catch(...)
{
if( dlog.debugging(Debug::WARN) )
dlog[Debug::WARN] << "(query): cath..." << endl;
if( dlog.is_warn() )
dlog.warn() << "(query): cath..." << endl;
}
return erTimeOut; // erHardwareError
......@@ -295,8 +295,8 @@ bool ModbusTCPMaster::checkConnection( const std::string ip, int port, int timeo
// -------------------------------------------------------------------------
void ModbusTCPMaster::reconnect()
{
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "(ModbusTCPMaster): reconnect " << iaddr << endl;
if( dlog.is_info() )
dlog.info() << "(ModbusTCPMaster): reconnect " << iaddr << endl;
if( tcp )
{
......@@ -320,7 +320,7 @@ void ModbusTCPMaster::reconnect()
{
ostringstream s;
s << "(ModbusTCPMaster): connection " << s.str() << " error: " << e.what();
dlog[Debug::CRIT] << s.str() << std::endl;
dlog.crit() << s.str() << std::endl;
}
}
catch( ... )
......@@ -329,7 +329,7 @@ void ModbusTCPMaster::reconnect()
{
ostringstream s;
s << "(ModbusTCPMaster): connection " << s.str() << " error: catch ...";
dlog[Debug::CRIT] << s.str() << std::endl;
dlog.crit() << s.str() << std::endl;
}
}
}
......@@ -354,9 +354,9 @@ void ModbusTCPMaster::connect( ost::InetAddress addr, int port )
ostringstream s;
s << addr << ":" << port;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "(ModbusTCPMaster): connect to " << s.str() << endl;
if( dlog.is_info() )
dlog.info() << "(ModbusTCPMaster): connect to " << s.str() << endl;
iaddr = s.str();
ost::Thread::setException(ost::Thread::throwException);
......@@ -371,7 +371,7 @@ void ModbusTCPMaster::connect( ost::InetAddress addr, int port )
{
ostringstream s;
s << "(ModbusTCPMaster): connection " << s.str() << " error: " << e.what();
dlog[Debug::CRIT] << s.str() << std::endl;
dlog.crit() << s.str() << std::endl;
}
}
catch( ... )
......@@ -380,7 +380,7 @@ void ModbusTCPMaster::connect( ost::InetAddress addr, int port )
{
ostringstream s;
s << "(ModbusTCPMaster): connection " << s.str() << " error: catch ...";
dlog[Debug::CRIT] << s.str() << std::endl;
dlog.crit() << s.str() << std::endl;
}
}
// }
......@@ -388,8 +388,8 @@ void ModbusTCPMaster::connect( ost::InetAddress addr, int port )
// -------------------------------------------------------------------------
void ModbusTCPMaster::disconnect()
{
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << iaddr << "(ModbusTCPMaster): disconnect." << endl;
if( dlog.is_info() )
dlog.info() << iaddr << "(ModbusTCPMaster): disconnect." << endl;
if( !tcp )
return;
......
......@@ -183,9 +183,9 @@ mbErrCode ModbusTCPServer::tcp_processing( ost::TCPStream& tcp, ModbusTCP::MBAPH
mhead.swapdata();
if( dlog.debugging(Debug::INFO) )
if( dlog.is_info() )
{
dlog[Debug::INFO] << "(ModbusTCPServer::tcp_processing): recv tcp header(" << len << "): ";
dlog.info() << "(ModbusTCPServer::tcp_processing): recv tcp header(" << len << "): ";
mbPrintMessage( dlog, (ModbusByte*)(&mhead), sizeof(mhead));
dlog(Debug::INFO) << endl;
}
......@@ -198,8 +198,8 @@ mbErrCode ModbusTCPServer::tcp_processing( ost::TCPStream& tcp, ModbusTCP::MBAPH
if( len<mhead.len )
{
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "(ModbusTCPServer::tcp_processing): len(" << (int)len
if( dlog.is_info() )
dlog.info() << "(ModbusTCPServer::tcp_processing): len(" << (int)len
<< ") < mhead.len(" << (int)mhead.len << ")" << endl;
return erInvalidFormat;
......@@ -219,9 +219,9 @@ mbErrCode ModbusTCPServer::pre_send_request( ModbusMessage& request )
curQueryHeader.len -= szCRC;
curQueryHeader.swapdata();
if( dlog.debugging(Debug::INFO) )
if( dlog.is_info() )
{
dlog[Debug::INFO] << "(ModbusTCPServer::pre_send_request): send tcp header: ";
dlog.info() << "(ModbusTCPServer::pre_send_request): send tcp header: ";
mbPrintMessage( dlog, (ModbusByte*)(&curQueryHeader), sizeof(curQueryHeader));
dlog(Debug::INFO) << endl;
}
......@@ -245,8 +245,8 @@ void ModbusTCPServer::cleanInputStream()
// -------------------------------------------------------------------------
void ModbusTCPServer::terminate()
{
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "(ModbusTCPServer): terminate..." << endl;
if( dlog.is_info() )
dlog.info() << "(ModbusTCPServer): terminate..." << endl;
if( tcp && tcp.isConnected() )
tcp.disconnect();
......
......@@ -54,7 +54,7 @@ void IORFile::setIOR( const ObjectId id, const ObjectId node, const string sior
if( !ior_file )
{
unideb[Debug::CRIT] << "(IORFile): не смог открыть файл "+fname << endl;
ulog.crit() << "(IORFile): не смог открыть файл "+fname << endl;
throw TimeOut("(IORFile): не смог создать ior-файл "+fname);
}
......
......@@ -45,8 +45,8 @@ namespace ORepHelpers
CosNaming::NamingContext_ptr getContext(const string& cname, int argc, const char* const* argv, const string& nsName )throw(ORepFailed)
{
CORBA::ORB_var orb = CORBA::ORB_init( argc, (char**)argv );
if( unideb.debugging(Debug::REPOSITORY) )
unideb[Debug::REPOSITORY] << "OREPHELP: orb init ok"<< endl;
if( ulog.is_repository() )
ulog.repository() << "OREPHELP: orb init ok"<< endl;
return getContext(orb, cname, nsName);
}
// --------------------------------------------------------------------------
......@@ -54,25 +54,26 @@ namespace ORepHelpers
{
CosNaming::NamingContext_var rootC;
if( unideb.debugging(Debug::REPOSITORY) )
unideb[Debug::REPOSITORY] << "OREPHELPER(getContext): get rootcontext...(servname = "<< servname << ")" <<endl;
if( ulog.is_repository() )
ulog.repository() << "OREPHELPER(getContext): get rootcontext...(servname = "<< servname << ")" <<endl;
rootC = getRootNamingContext(orb, servname);
if( unideb.debugging(Debug::REPOSITORY) )
unideb[Debug::REPOSITORY] << "OREPHELPER(getContext): get rootContect ok " << endl;
if( ulog.is_repository() )
ulog.repository() << "OREPHELPER(getContext): get rootContect ok " << endl;
if( CORBA::is_nil(rootC) )
{
unideb[Debug::type(Debug::WARN|Debug::REPOSITORY)] << "OREPHELPER: не смог получить ссылку на NameServices"<< endl;
if( ulog.is_warn() )
ulog.warn() << "OREPHELPER: не смог получить ссылку на NameServices"<< endl;
throw ORepFailed("OREPHELPER(getContext): не смог получить ссылку на NameServices");
}
if ( cname.empty() )
return rootC._retn();
if( unideb.debugging(Debug::REPOSITORY) )
unideb[Debug::REPOSITORY] << "OREPHELPER(getContext): get ref context " << cname << endl;
if( ulog.is_repository() )
ulog.repository() << "OREPHELPER(getContext): get ref context " << cname << endl;
CosNaming::Name_var ctxName = omniURI::stringToName(cname.c_str());
CosNaming::NamingContext_var ctx;
......@@ -90,14 +91,16 @@ namespace ORepHelpers
{
ostringstream err;
err << "OREPHELPER(getContext): не смог получить ссылку на контекст " << cname;
unideb[Debug::type(Debug::WARN|Debug::REPOSITORY)] << err.str() << endl;
if( ulog.is_warn() )
ulog.warn() << err.str() << endl;
throw ORepFailed(err.str());
}
catch(const CosNaming::NamingContext::NotFound &nf)
{
ostringstream err;
err << "OREPHELPER(getContext): не найден контекст " << cname;
unideb[Debug::WARN] << err.str() << endl;
if( ulog.warn() )
ulog.warn() << err.str() << endl;
throw ORepFailed(err.str());
}
catch(const CosNaming::NamingContext::CannotProceed &np)
......@@ -105,34 +108,40 @@ namespace ORepHelpers
ostringstream err;
err << "OREPHELPER(getContext): catch CannotProced " << cname;
err << " bad part=" << omniURI::nameToString(np.rest_of_name);
unideb[Debug::WARN] << err.str() << endl;
if( ulog.is_warn() )
ulog.warn() << err.str() << endl;
throw ORepFailed(err.str());
}
catch(CORBA::SystemException& ex)
{
ostringstream err;
err << "OREPHELPER(getContext): поймали CORBA::SystemException: " << ex.NP_minorString();
unideb[Debug::type(Debug::WARN|Debug::REPOSITORY)] << err.str() << endl;
if( ulog.is_warn() )
ulog.warn() << err.str() << endl;
throw ORepFailed(err.str());
}
catch(CORBA::Exception&)
{
unideb[Debug::type(Debug::WARN|Debug::REPOSITORY)] << "OREPHELPER(getContext): поймали CORBA::Exception." << endl;
if( ulog.is_warn() )
ulog.warn() << "OREPHELPER(getContext): поймали CORBA::Exception." << endl;
throw ORepFailed();
}
catch(omniORB::fatalException& fe)
{
ostringstream err;
err << "OREPHELPER(getContext): поймали omniORB::fatalException:";
unideb[Debug::type(Debug::WARN|Debug::REPOSITORY)] << err << endl;
unideb[Debug::type(Debug::WARN|Debug::REPOSITORY)] << " file: " << fe.file() << endl;
unideb[Debug::type(Debug::WARN|Debug::REPOSITORY)] << " line: " << fe.line() << endl;
unideb[Debug::type(Debug::WARN|Debug::REPOSITORY)] << " mesg: " << fe.errmsg() << endl;
if( ulog.is_warn() )
{
ulog.warn() << err << endl;
ulog.warn() << " file: " << fe.file() << endl;
ulog.warn() << " line: " << fe.line() << endl;
ulog.warn() << " mesg: " << fe.errmsg() << endl;
}
throw ORepFailed(err.str());
}
if( unideb.debugging(Debug::REPOSITORY) )
unideb[Debug::REPOSITORY] << "getContext: получили "<< cname << endl;
if( ulog.is_repository() )
ulog.repository() << "getContext: получили "<< cname << endl;
// Если _var
// return CosNaming::NamingContext::_duplicate(ctx);
......@@ -151,8 +160,8 @@ namespace ORepHelpers
{
// cout << "ORepHelpers(getRootNamingContext): nsName->" << nsName << endl;
CORBA::Object_var initServ = orb->resolve_initial_references(nsName.c_str());
if( unideb.debugging(Debug::REPOSITORY) )
unideb[Debug::REPOSITORY] << "OREPHELP: get rootcontext...(nsName = "<< nsName << ")" <<endl;
if( ulog.is_repository() )
ulog.repository() << "OREPHELP: get rootcontext...(nsName = "<< nsName << ")" <<endl;
rootContext = CosNaming::NamingContext::_narrow(initServ);
if (CORBA::is_nil(rootContext))
......@@ -161,14 +170,15 @@ namespace ORepHelpers
throw ORepFailed(err.c_str());
}
if( unideb.debugging(Debug::REPOSITORY) )
unideb[Debug::REPOSITORY] << "OREPHELP: init NameService ok"<< endl;
if( ulog.is_repository() )
ulog.repository() << "OREPHELP: init NameService ok"<< endl;
}
catch(CORBA::ORB::InvalidName& ex)
{
ostringstream err;
err << "ORepHelpers(getRootNamingContext): InvalidName=" << nsName;
unideb[Debug::type(Debug::WARN|Debug::REPOSITORY)] << err.str() << endl;
if( ulog.is_warn() )
ulog.warn() << err.str() << endl;
throw ORepFailed(err.str());
}
catch (CORBA::COMM_FAILURE& ex)
......@@ -188,8 +198,8 @@ namespace ORepHelpers
throw ORepFailed(err);
}
if( unideb.debugging(Debug::REPOSITORY) )
unideb[Debug::REPOSITORY] << "OREPHELP: get root context ok"<< endl;
if( ulog.is_repository() )
ulog.repository() << "OREPHELP: get root context ok"<< endl;
// // Если создан как _ptr
// return rootContext;
......
......@@ -119,12 +119,12 @@ unsigned int ObjectIndex_XML::read_section( UniXML& xml, const std::string sec,
{
if( (unsigned)ind >= omap.size() )
{
if( unideb.debugging(Debug::INFO) )
if( ulog.is_info() )
{
ostringstream msg;
msg << "(ObjectIndex_XML::build): не хватило размера массива maxSize=" << omap.size();
// throw OutOfRange(msg.str());
unideb[Debug::WARN] << msg.str() << "... Делаем resize + 100\n";
ulog.warn() << msg.str() << "... Делаем resize + 100\n";
}
omap.resize(omap.size()+100);
......@@ -135,7 +135,7 @@ unsigned int ObjectIndex_XML::read_section( UniXML& xml, const std::string sec,
{
ostringstream msg;
msg << "(ObjectIndex_XML::build):: не нашли параметр RootSection в конф. файле ";
unideb[Debug::CRIT] << msg.str() << endl;
ulog.crit() << msg.str() << endl;
throw SystemError(msg.str());
}
......@@ -199,12 +199,13 @@ unsigned int ObjectIndex_XML::read_section( UniXML& xml, const std::string sec,
if( (unsigned)ind >= omap.size() )
{
if( unideb.debugging(Debug::INFO) )
if( ulog.is_info() )
{
ostringstream msg;
msg << "(ObjectIndex_XML::build): не хватило размера массива maxSize=" << omap.size();
// throw OutOfRange(msg.str());
unideb[Debug::INFO] << msg.str() << "... Делаем resize + 100\n";
if( ulog.is_info() )
ulog.info() << msg.str() << "... Делаем resize + 100\n";
}
omap.resize(omap.size()+100);
}
......@@ -220,7 +221,7 @@ unsigned int ObjectIndex_XML::read_nodes( UniXML& xml, const std::string sec, un
ostringstream msg;
msg << "(ObjectIndex_XML::build): не хватило размера массива maxSize=" << omap.size();
// throw OutOfRange(msg.str());
unideb[Debug::WARN] << msg.str() << "... Делаем resize + 100\n";
ulog.warn() << msg.str() << "... Делаем resize + 100\n";
omap.resize(omap.size()+100);
}
......@@ -276,7 +277,7 @@ unsigned int ObjectIndex_XML::read_nodes( UniXML& xml, const std::string sec, un
ostringstream msg;
msg << "(ObjectIndex_XML::build): не хватило размера массива maxSize=" << omap.size();
// throw OutOfRange(msg.str());
unideb[Debug::WARN] << msg.str() << "... Делаем resize + 100\n";
ulog.warn() << msg.str() << "... Делаем resize + 100\n";
omap.resize(omap.size()+100);
}
}
......
......@@ -93,7 +93,7 @@ void ObjectIndex_idXML::read_section( UniXML& xml, const std::string sec )
{
ostringstream msg;
msg << "(ObjectIndex_idXML::build):: не нашли параметр RootSection в конф. файле ";
unideb[Debug::CRIT] << msg.str() << endl;
ulog.crit() << msg.str() << endl;
throw SystemError(msg.str());
}
......
......@@ -98,8 +98,8 @@ void ObjectRepository::registration(const string& name, const ObjectPtr oRef, co
{
ostringstream err;
if( unideb.debugging(Debug::type(Debug::INFO|Debug::REPOSITORY)) )
unideb[Debug::type(Debug::INFO|Debug::REPOSITORY)] << "ObjectRepository(registration): регистрируем " << name << endl;
if( ulog.is_info() )
ulog.info() << "ObjectRepository(registration): регистрируем " << name << endl;
// Проверка корректности имени
char bad = ORepHelpers::checkBadSymbols(name);
......@@ -127,8 +127,8 @@ void ObjectRepository::registration(const string& name, const ObjectPtr oRef, co
}
catch(const CosNaming::NamingContext::AlreadyBound &nf)
{
if( unideb.debugging(Debug::type(Debug::WARN|Debug::REPOSITORY)) )
unideb[Debug::type(Debug::WARN|Debug::REPOSITORY)] << "(registration): "<< name <<" уже зарегестрирован в "<< section << "!!!" << endl;
if( ulog.is_warn() )
ulog.warn() << "(registration): "<< name <<" уже зарегестрирован в "<< section << "!!!" << endl;
if( !force )
throw ObjectNameAlready();
......@@ -136,40 +136,11 @@ void ObjectRepository::registration(const string& name, const ObjectPtr oRef, co
// разрегистриуем, перед повтроной попыткой
ctx->unbind(oName);
continue;
/*
// делаем проверку жив ли объект
bool life(false);
try
{
unideb[Debug::type(Debug::INFO|Debug::REPOSITORY)] << "(registration): " << name << " уже есть... проверяем живой ли? "<< endl;
CORBA::Object_var ref = ctx->resolve(oName);
UniSetObject_i_var uobj = UniSetObject_i::_narrow(ref);
uobj->getId(); // пытаемся вызвать функцию (любую), если не сможет сработает исключение
life = true;
unideb[Debug::type(Debug::INFO|Debug::REPOSITORY)] << "(registration): " << name << " живой! "<< endl;
}
catch(...)
{
life=false;
}
if( !life )
{
unideb(Debug::type(Debug::WARN|Debug::REPOSITORY)) << "(registration): " << name << " ЕСТЬ в репозитории, но недоступен. Заменяем на новую ссылку "<< endl;
ctx->rebind(oName, oRef);
}
else
{
unideb[Debug::type(Debug::WARN|Debug::REPOSITORY)] << "(registration): "<< name <<" уже зарегестрирован в "<< section<< "!!!!!!!!!!!" << endl;
throw ObjectNameAlready();
}
return;
*/
}
catch(ORepFailed)
{
string er("ObjectRepository(registrartion): (getContext) не смог зарегистрировать "+name);
throw ORepFailed(er.c_str());
throw ORepFailed(er.c_str());
}
catch(CosNaming::NamingContext::NotFound)
{
......@@ -181,19 +152,20 @@ void ObjectRepository::registration(const string& name, const ObjectPtr oRef, co
}
catch(const CosNaming::NamingContext::CannotProceed &cp)
{
err << "ObjectRepository(registrartion): catch CannotProced " << name << " bad part=";
err << "ObjectRepository(registrartion): catch CannotProced " << name << " bad part=";
err << omniURI::nameToString(cp.rest_of_name);
}
catch(CORBA::SystemException& ex)
{
unideb[Debug::type(Debug::WARN|Debug::REPOSITORY)] << "ObjectRepository(registrartion): поймали CORBA::SystemException: "
if( ulog.is_warn() )
ulog.warn() << "ObjectRepository(registrartion): поймали CORBA::SystemException: "
<< ex.NP_minorString() << endl;
err << "ObjectRepository(registrartion): поймали CORBA::SystemException: " << ex.NP_minorString();
}
// catch(...)
// {
// unideb[Debug::WARN] << "поймали что-то неизвестное..."<< endl;
// ulog.warn() << "поймали что-то неизвестное..."<< endl;
// }
}
......@@ -231,23 +203,23 @@ void ObjectRepository::registration( const std::string& fullName, const UniSetTy
void ObjectRepository::unregistration(const string& name, const string& section)
throw(ORepFailed, NameNotFound)
{
// unideb[Debug::INFO] << "OREP: unregistration "<< name << " из "<< section << endl;
// ulog.info() << "OREP: unregistration "<< name << " из "<< section << endl;
ostringstream err;
CosNaming::Name_var oName = omniURI::stringToName(name.c_str());
// unideb[Debug::INFO] << "OREP: string to name ok"<< endl;
// ulog.info() << "OREP: string to name ok"<< endl;
CosNaming::NamingContext_var ctx;
CORBA::ORB_var orb = uconf->getORB();
ctx = ORepHelpers::getContext(orb, section, nsName);
// unideb[Debug::INFO] << "OREP: get context " << section <<" ok"<< endl;
// ulog.info() << "OREP: get context " << section <<" ok"<< endl;
try
{
// Удаляем запись об объекте
ctx->unbind(oName);
// unideb[Debug::INFO] << "OREP: ok" << endl;
// ulog.info() << "OREP: ok" << endl;
return;
}
catch(const CosNaming::NamingContext::NotFound &nf)
......@@ -372,7 +344,7 @@ bool ObjectRepository::listSections(const string& in_section, ListObjectName *ls
bool ObjectRepository::list(const string& section, ListObjectName *ls, unsigned int how_many, ObjectType type)
{
// Возвращает false если вынут не весь список...
// unideb[Debug::INFO] << "получаем список из "<< section << endl;
// ulog.info() << "получаем список из "<< section << endl;
CosNaming::NamingContext_var ctx;
try
{
......@@ -381,14 +353,14 @@ bool ObjectRepository::list(const string& section, ListObjectName *ls, unsigned
}
catch(ORepFailed)
{
unideb[Debug::type(Debug::WARN|Debug::REPOSITORY)] << "ORepository(list): не смог получить ссылку на "<< section << endl;
ulog.warn() << "ORepository(list): не смог получить ссылку на "<< section << endl;
throw;
// return false;
}
if( CORBA::is_nil(ctx) )
{
unideb[Debug::type(Debug::WARN|Debug::REPOSITORY)] << "ORepository(list): не смог получить ссылку на "<< section << endl;
ulog.warn() << "ORepository(list): не смог получить ссылку на "<< section << endl;
throw ORepFailed();
}
......@@ -463,10 +435,10 @@ bool ObjectRepository::isExist( ObjectPtr oref )
catch(CORBA::Exception&){}
catch(omniORB::fatalException& fe)
{
unideb[Debug::type(Debug::WARN|Debug::REPOSITORY)] << "ObjectRepository(isExist): "<< "поймали omniORB::fatalException:" << endl;
unideb[Debug::type(Debug::WARN|Debug::REPOSITORY)] << " file: " << fe.file() << endl;
unideb[Debug::type(Debug::WARN|Debug::REPOSITORY)] << " line: " << fe.line() << endl;
unideb[Debug::type(Debug::WARN|Debug::REPOSITORY)] << " mesg: " << fe.errmsg() << endl;
ulog.warn() << "ObjectRepository(isExist): "<< "поймали omniORB::fatalException:" << endl;
ulog.warn() << " file: " << fe.file() << endl;
ulog.warn() << " line: " << fe.line() << endl;
ulog.warn() << " mesg: " << fe.errmsg() << endl;
}
catch(...){}
......
......@@ -64,10 +64,11 @@ bool ObjectRepositoryFactory::createSection( const char* name, const char* in_se
throw ( InvalidObjectName(err.str().c_str()) );
}
unideb[Debug::REPOSITORY] << "CreateSection: name = "<< name << " in section = " << in_section << endl;
ulog.repository() << "CreateSection: name = "<< name << " in section = " << in_section << endl;
if( sizeof(in_section)==0 )
{
unideb[Debug::REPOSITORY] << "CreateSection: in_section=0"<< endl;
if( ulog.repository() )
ulog.repository() << "CreateSection: in_section=0"<< endl;
return createRootSection(name);
}
......@@ -92,13 +93,16 @@ bool ObjectRepositoryFactory::createSectionF(const string& fullName)throw(ORepFa
string name(ObjectIndex::getBaseName(fullName));
string sec(ORepHelpers::getSectionName(fullName));
unideb[Debug::REPOSITORY] << name << endl;
unideb[Debug::REPOSITORY] << sec << endl;
ulog.repository() << name << endl;
ulog.repository() << sec << endl;
if ( sec.empty() )
{
unideb[Debug::REPOSITORY] << "SectionName is empty!!!"<< endl;
unideb[Debug::REPOSITORY] << "Добавляем в "<< uconf->getRootSection() << endl;
if( ulog.repository() )
{
ulog.repository() << "SectionName is empty!!!"<< endl;
ulog.repository() << "Добавляем в "<< uconf->getRootSection() << endl;
}
return createSection(name, uconf->getRootSection());
}
else
......@@ -125,49 +129,59 @@ bool ObjectRepositoryFactory::createContext(const char *cname, CosNaming::Naming
CosNaming::Name_var nc = omniURI::stringToName(cname);
try
{
unideb[Debug::REPOSITORY] << "ORepFactory(createContext): создаю новый контекст "<< cname << endl;
if( ulog.repository() )
ulog.repository() << "ORepFactory(createContext): создаю новый контекст "<< cname << endl;
ctx->bind_new_context(nc);
unideb[Debug::REPOSITORY] << "ORepFactory(createContext): создал. " << endl;
if( ulog.repository() )
ulog.repository() << "ORepFactory(createContext): создал. " << endl;
return true;
}
catch(const CosNaming::NamingContext::AlreadyBound &ab)
{
// ctx->resolve(nc);
unideb[Debug::REPOSITORY] <<"ORepFactory(createContext): context "<< cname << " уже есть"<< endl;
if( ulog.repository() )
ulog.repository() <<"ORepFactory(createContext): context "<< cname << " уже есть"<< endl;
return true;
}
catch(CosNaming::NamingContext::NotFound)
{
unideb[Debug::REPOSITORY] <<"ORepFactory(createContext): NotFound "<< cname << endl;
if( ulog.repository() )
ulog.repository() <<"ORepFactory(createContext): NotFound "<< cname << endl;
throw NameNotFound();
}
catch(const CosNaming::NamingContext::InvalidName &nf)
{
// unideb[Debug::WARN] << "invalid name"<< endl;
unideb[Debug::type(Debug::WARN|Debug::REPOSITORY)] << "ORepFactory(createContext): (InvalidName) " << cname;
if( ulog.is_warn() )
ulog.warn() << "ORepFactory(createContext): (InvalidName) " << cname;
}
catch(const CosNaming::NamingContext::CannotProceed &cp)
{
unideb[Debug::type(Debug::WARN|Debug::REPOSITORY)] << "ORepFactory(createContext): catch CannotProced "
if( ulog.is_crit() )
ulog.warn() << "ORepFactory(createContext): catch CannotProced "
<< cname << " bad part="
<< omniURI::nameToString(cp.rest_of_name);
throw NameNotFound();
}
catch( CORBA::SystemException& ex)
{
unideb[Debug::type(Debug::CRIT|Debug::REPOSITORY)] << "ORepFactory(createContext): CORBA::SystemException: "
<< ex.NP_minorString() << endl;
if( ulog.is_crit() )
ulog.crit() << "ORepFactory(createContext): CORBA::SystemException: "
<< ex.NP_minorString() << endl;
}
catch(CORBA::Exception&)
{
unideb[Debug::type(Debug::CRIT|Debug::REPOSITORY)] << "поймали CORBA::Exception." << endl;
if( ulog.is_crit() )
ulog.crit() << "поймали CORBA::Exception." << endl;
}
catch(omniORB::fatalException& fe)
{
unideb[Debug::type(Debug::CRIT|Debug::REPOSITORY)] << "поймали omniORB::fatalException:" << endl;
unideb[Debug::type(Debug::CRIT|Debug::REPOSITORY)] << " file: " << fe.file() << endl;
unideb[Debug::type(Debug::CRIT|Debug::REPOSITORY)] << " line: " << fe.line() << endl;
unideb[Debug::type(Debug::CRIT|Debug::REPOSITORY)] << " mesg: " << fe.errmsg() << endl;
if( ulog.is_crit() )
{
ulog.crit() << "поймали omniORB::fatalException:" << endl;
ulog.crit() << " file: " << fe.file() << endl;
ulog.crit() << " line: " << fe.line() << endl;
ulog.crit() << " mesg: " << fe.errmsg() << endl;
}
}
return false;
......@@ -253,19 +267,19 @@ bool ObjectRepositoryFactory::removeSection(const string& fullName, bool recursi
if( recursive )
{
unideb[Debug::REPOSITORY] << "ORepFactory: удаляем рекурсивно..." << endl;
ulog.repository() << "ORepFactory: удаляем рекурсивно..." << endl;
string rctx = fullName+"/"+omniURI::nameToString(bl[i].binding_name);
unideb[Debug::REPOSITORY] << rctx << endl;
ulog.repository() << rctx << endl;
if ( !removeSection(rctx))
{
unideb[Debug::REPOSITORY] << "рекурсивно удалить не удалось" << endl;
ulog.repository() << "рекурсивно удалить не удалось" << endl;
rem = false;
}
}
else
{
unideb[Debug::REPOSITORY] << "ORepFactory: " << omniURI::nameToString(bl[i].binding_name) << " - контекст!!! ";
unideb[Debug::REPOSITORY] << "ORepFactory: пока не удаляем" << endl;
ulog.repository() << "ORepFactory: " << omniURI::nameToString(bl[i].binding_name) << " - контекст!!! ";
ulog.repository() << "ORepFactory: пока не удаляем" << endl;
rem = false;
}
}
......@@ -291,12 +305,12 @@ bool ObjectRepositoryFactory::removeSection(const string& fullName, bool recursi
}
catch(const CosNaming::NamingContext::NotEmpty &ne)
{
unideb[Debug::REPOSITORY] << "ORepFactory: контекст" << fullName << " не пустой " << endl;
ulog.repository() << "ORepFactory: контекст" << fullName << " не пустой " << endl;
rem = false;
}
catch( ORepFailed )
{
unideb[Debug::REPOSITORY] << "ORepFactory: не удаось получить ссылку на контекст " << in_sec << endl;
ulog.repository() << "ORepFactory: не удаось получить ссылку на контекст " << in_sec << endl;
rem=false;
}
}
......@@ -322,8 +336,8 @@ bool ObjectRepositoryFactory::renameSection( const string& newFName, const strin
try
{
// unideb[Debug::REPOSITORY] << "ORepFactory: в контексте "<< in_sec << endl;
// unideb[Debug::REPOSITORY] << "ORepFactory: переименовываем " << oldFName << " в " << newFName << endl;
// ulog.repository() << "ORepFactory: в контексте "<< in_sec << endl;
// ulog.repository() << "ORepFactory: переименовываем " << oldFName << " в " << newFName << endl;
int argc(uconf->getArgc());
const char * const* argv(uconf->getArgv());
CosNaming::NamingContext_var in_ctx = ORepHelpers::getContext(in_sec, argc, argv, nsName);
......
......@@ -137,7 +137,7 @@ void ObjectsManager::initPOA( ObjectsManager* rmngr )
poa = rmngr->getPOA();
if( CORBA::is_nil(poa) )
unideb[Debug::CRIT] << myname << "(initPOA): failed init poa " << endl;
ulog.crit() << myname << "(initPOA): failed init poa " << endl;
// Инициализация самого менеджера и его подобъектов
UniSetObject::init(rmngr);
......@@ -152,8 +152,8 @@ bool ObjectsManager::addObject( UniSetObject *obj )
ObjectsList::iterator li=find(olist.begin(),olist.end(), obj);
if( li==olist.end() )
{
if( unideb.debugging(Debug::INFO) )
unideb[Debug::INFO] << myname << "(activator): добавляем объект "<< obj->getName()<< endl;
if( ulog.is_info() )
ulog.info() << myname << "(activator): добавляем объект "<< obj->getName()<< endl;
olist.push_back(obj);
}
} // unlock
......@@ -168,28 +168,28 @@ bool ObjectsManager::removeObject(UniSetObject* obj)
ObjectsList::iterator li=find(olist.begin(),olist.end(), obj);
if( li!=olist.end() )
{
if( unideb.debugging(Debug::INFO) )
unideb[Debug::INFO] << myname << "(activator): удаляем объект "<< obj->getName()<< endl;
if( ulog.is_info() )
ulog.info() << myname << "(activator): удаляем объект "<< obj->getName()<< endl;
try
{
obj->disactivate();
}
catch(Exception& ex)
{
unideb[Debug::WARN] << myname << "(removeObject): " << ex << endl;
ulog.warn() << myname << "(removeObject): " << ex << endl;
}
catch(CORBA::SystemException& ex)
{
unideb[Debug::WARN] << myname << "(removeObject): поймали CORBA::SystemException: " << ex.NP_minorString() << endl;
ulog.warn() << myname << "(removeObject): поймали CORBA::SystemException: " << ex.NP_minorString() << endl;
}
catch(CORBA::Exception& ex)
{
unideb[Debug::WARN] << myname << "(removeObject): CORBA::Exception" << endl;
ulog.warn() << myname << "(removeObject): CORBA::Exception" << endl;
}
catch( omniORB::fatalException& fe )
{
unideb[Debug::CRIT] << myname << "(managers): Caught omniORB::fatalException:" << endl;
unideb[Debug::CRIT] << myname << "(managers): file: " << fe.file()
ulog.crit() << myname << "(managers): Caught omniORB::fatalException:" << endl;
ulog.crit() << myname << "(managers): file: " << fe.file()
<< " line: " << fe.line()
<< " mesg: " << fe.errmsg() << endl;
}
......@@ -208,8 +208,8 @@ bool ObjectsManager::removeObject(UniSetObject* obj)
*/
void ObjectsManager::managers(OManagerCommand cmd)
{
if( unideb.debugging(Debug::INFO) )
unideb[Debug::INFO] << myname <<"(managers): mlist.size="
if( ulog.is_info() )
ulog.info() << myname <<"(managers): mlist.size="
<< mlist.size() << " cmd=" << cmd << endl;
{ //lock
uniset_rwmutex_rlock lock(mlistMutex);
......@@ -241,28 +241,28 @@ void ObjectsManager::managers(OManagerCommand cmd)
}
catch( Exception& ex )
{
if( unideb.debugging(Debug::CRIT) )
if( ulog.is_crit() )
{
unideb[Debug::CRIT] << myname << "(managers): " << ex << endl;
unideb[Debug::CRIT] << myname << "(managers): не смог зарегистрировать (разрегистрировать) объект -->"<< (*li)->getName() << endl;
ulog.crit() << myname << "(managers): " << ex << endl;
ulog.crit() << myname << "(managers): не смог зарегистрировать (разрегистрировать) объект -->"<< (*li)->getName() << endl;
}
}
catch(CORBA::SystemException& ex)
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(managers): поймали CORBA::SystemException:" << ex.NP_minorString() << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(managers): поймали CORBA::SystemException:" << ex.NP_minorString() << endl;
}
catch( CORBA::Exception& ex )
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(managers): Caught CORBA::Exception. " << ex._name() << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(managers): Caught CORBA::Exception. " << ex._name() << endl;
}
catch( omniORB::fatalException& fe )
{
if( unideb.debugging(Debug::CRIT) )
if( ulog.is_crit() )
{
unideb[Debug::CRIT] << myname << "(managers): Caught omniORB::fatalException:" << endl;
unideb[Debug::CRIT] << myname << "(managers): file: " << fe.file()
ulog.crit() << myname << "(managers): Caught omniORB::fatalException:" << endl;
ulog.crit() << myname << "(managers): file: " << fe.file()
<< " line: " << fe.line()
<< " mesg: " << fe.errmsg() << endl;
}
......@@ -276,8 +276,8 @@ void ObjectsManager::managers(OManagerCommand cmd)
*/
void ObjectsManager::objects(OManagerCommand cmd)
{
if( unideb.debugging(Debug::INFO) )
unideb[Debug::INFO] << myname <<"(objects): olist.size="
if( ulog.is_info() )
ulog.info() << myname <<"(objects): olist.size="
<< olist.size() << " cmd=" << cmd << endl;
{ //lock
uniset_rwmutex_rlock lock(olistMutex);
......@@ -310,30 +310,30 @@ void ObjectsManager::objects(OManagerCommand cmd)
}
catch( Exception& ex )
{
if( unideb.debugging(Debug::CRIT) )
if( ulog.is_crit() )
{
unideb[Debug::CRIT] << myname << "(objects): " << ex << endl;
unideb[Debug::CRIT] << myname << "(objects): не смог зарегистрировать (разрегистрировать) объект -->"<< (*li)->getName() << endl;
ulog.crit() << myname << "(objects): " << ex << endl;
ulog.crit() << myname << "(objects): не смог зарегистрировать (разрегистрировать) объект -->"<< (*li)->getName() << endl;
}
}
catch(CORBA::SystemException& ex)
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(objects): поймали CORBA::SystemException:" << ex.NP_minorString() << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(objects): поймали CORBA::SystemException:" << ex.NP_minorString() << endl;
}
catch( CORBA::Exception& ex )
{
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(objects): Caught CORBA::Exception. "
<< ex._name()
<< " (" << (*li)->getName() << ")" << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(objects): Caught CORBA::Exception. "
<< ex._name()
<< " (" << (*li)->getName() << ")" << endl;
}
catch( omniORB::fatalException& fe )
{
if( unideb.debugging(Debug::CRIT) )
if( ulog.is_crit() )
{
unideb[Debug::CRIT] << myname << "(objects): Caught omniORB::fatalException:" << endl;
unideb[Debug::CRIT] << myname << "(objects): file: " << fe.file()
ulog.crit() << myname << "(objects): Caught omniORB::fatalException:" << endl;
ulog.crit() << myname << "(objects): file: " << fe.file()
<< " line: " << fe.line()
<< " mesg: " << fe.errmsg() << endl;
}
......@@ -348,8 +348,8 @@ void ObjectsManager::objects(OManagerCommand cmd)
*/
bool ObjectsManager::activateObject()
{
if( unideb.debugging(Debug::INFO) )
unideb[Debug::INFO] << myname << "(activateObjects): активизирую объекты"<< endl;
if( ulog.is_info() )
ulog.info() << myname << "(activateObjects): активизирую объекты"<< endl;
UniSetObject::activateObject();
managers(activ);
objects(activ);
......@@ -362,8 +362,8 @@ bool ObjectsManager::activateObject()
*/
bool ObjectsManager::disactivateObject()
{
if( unideb.debugging(Debug::INFO) )
unideb[Debug::INFO] << myname << "(disactivateObjects): деактивизирую объекты"<< endl;
if( ulog.is_info() )
ulog.info() << myname << "(disactivateObjects): деактивизирую объекты"<< endl;
// именно в такой последовательности!
objects(deactiv);
managers(deactiv);
......@@ -372,7 +372,7 @@ bool ObjectsManager::disactivateObject()
// ------------------------------------------------------------------------------------------
void ObjectsManager::sigterm( int signo )
{
// unideb[Debug::INFO] << "ObjectsActivator: default processing signo="<< signo << endl;
// ulog.info() << "ObjectsActivator: default processing signo="<< signo << endl;
sig=signo;
objects(term);
managers(term);
......@@ -409,11 +409,11 @@ bool ObjectsManager::addManager( ObjectsManager *child )
if(it == mlist.end() )
{
mlist.push_back( child );
if( unideb.debugging(Debug::INFO) )
unideb[Debug::INFO] << myname << ": добавляем менеджер "<< child->getName()<< endl;
if( ulog.is_info() )
ulog.info() << myname << ": добавляем менеджер "<< child->getName()<< endl;
}
else if( unideb.debugging(Debug::WARN) )
unideb[Debug::WARN] << myname << ": попытка повторного добавления объекта "<< child->getName() << endl;
else if( ulog.is_warn() )
ulog.warn() << myname << ": попытка повторного добавления объекта "<< child->getName() << endl;
} // unlock
return true;
......@@ -505,11 +505,11 @@ int ObjectsManager::getObjectsInfo( ObjectsManager* mngr, SimpleInfoSeq* seq,
}
catch(CORBA::Exception& ex)
{
unideb[Debug::WARN] << myname << "(getObjectsInfo): CORBA::Exception" << endl;
ulog.warn() << myname << "(getObjectsInfo): CORBA::Exception" << endl;
}
catch(...)
{
unideb[Debug::WARN] << myname << "(getObjectsInfo): не смог получить у объекта "
ulog.warn() << myname << "(getObjectsInfo): не смог получить у объекта "
<< conf->oind->getNameById( (*it)->getId() ) << " информацию" << endl;
}
}
......
......@@ -61,7 +61,7 @@ void ObjectsManager_LT::callback()
}
catch(Exception& ex)
{
unideb[Debug::CRIT] << myname << "(callback): " << ex << endl;
ulog.crit() << myname << "(callback): " << ex << endl;
}
}
// ------------------------------------------------------------------------------------------
......
......@@ -117,13 +117,13 @@ void PassiveObject::processingMessage( UniSetTypes::VoidMessage* msg )
}
default:
//unideb[Debug::WARN] << myname << ": неизвестное сообщение " << msg->type << endl;
//ulog.warn() << myname << ": неизвестное сообщение " << msg->type << endl;
break;
}
}
catch(Exception& ex)
{
// unideb[Debug::WARN]
// ulog.warn()
// cerr << myname << "(processingMessage): " << ex << endl;
}
}
......
......@@ -48,7 +48,7 @@ void ProxyManager::attachObject( PassiveObject* po, UniSetTypes::ObjectId id )
{
if( id == DefaultObjectId )
{
unideb[Debug::WARN] << myname << "(attachObject): попытка добавить объект с id="
ulog.warn() << myname << "(attachObject): попытка добавить объект с id="
<< DefaultObjectId << " PassiveObject=" << po->getName() << endl;
return;
......@@ -81,9 +81,9 @@ bool ProxyManager::activateObject()
{
try
{
if( unideb.debugging(Debug::INFO) )
if( ulog.is_info() )
{
unideb[Debug::INFO] << myname << "(registered): попытка "
ulog.info() << myname << "(registered): попытка "
<< i+1 << " регистриую (id=" << it->first << ") "
<< " (pname=" << it->second->getName() << ") "
<< conf->oind->getNameById(it->first) << endl;
......@@ -93,21 +93,24 @@ bool ProxyManager::activateObject()
}
catch( UniSetTypes::ObjectNameAlready& ex )
{
unideb[Debug::CRIT] << myname << "(registered): СПЕРВА РАЗРЕГИСТРИРУЮ (ObjectNameAlready)" << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(registered): СПЕРВА РАЗРЕГИСТРИРУЮ (ObjectNameAlready)" << endl;
try
{
ui.unregister(it->first);
}
catch(Exception & ex)
{
unideb[Debug::CRIT] << myname << "(unregistered): " << ex << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(unregistered): " << ex << endl;
}
}
}
}
catch(Exception& ex )
catch( Exception& ex )
{
unideb[Debug::CRIT] << myname << "(activate): " << ex << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(activate): " << ex << endl;
}
}
......@@ -124,7 +127,8 @@ bool ProxyManager::disactivateObject()
}
catch(Exception& ex )
{
unideb[Debug::CRIT] << myname << "(activate): " << ex << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(activate): " << ex << endl;
}
}
......@@ -146,9 +150,9 @@ void ProxyManager::processingMessage( UniSetTypes::VoidMessage *msg )
PObjectMap::iterator it = omap.find(msg->consumer);
if( it!=omap.end() )
it->second->processingMessage(msg);
else
else if( ulog.is_crit() )
{
unideb[Debug::CRIT] << myname << "(processingMessage): не найден объект "
ulog.crit() << myname << "(processingMessage): не найден объект "
<< " consumer= " << msg->consumer << endl;
}
}
......@@ -157,7 +161,8 @@ void ProxyManager::processingMessage( UniSetTypes::VoidMessage *msg )
}
catch( Exception& ex )
{
unideb[Debug::CRIT] << myname << "(processingMessage): " << ex << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(processingMessage): " << ex << endl;
}
}
// -------------------------------------------------------------------------
......@@ -171,7 +176,8 @@ void ProxyManager::allMessage( UniSetTypes::VoidMessage* msg )
}
catch( Exception& ex )
{
unideb[Debug::CRIT] << myname << "(allMessage): " << ex << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(allMessage): " << ex << endl;
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment