Stream operator so that an entire hzChain contents can be output to the logfile.
| Return Type | Function name | Arguments |
|---|---|---|
| hzLogger& | hzLogger::operator<< | (hzChain&,) |
Declared in file: hzProcess.h
Defined in file : hzLogger.cpp
Function Logic:
Function body:
hzLogger& hzLogger::operator<< (hzChain& Z)
{
// Stream operator so that an entire hzChain contents can be output to the logfile.
//
// Arguments: 1) Z Chain to aggregate to logger
//
// Returns: Reference to this logger
// _hzfunc("hzLogger::operator<<(hzChain)") ;
hzChain::Iter zi ; // Message chain iterator
char* i ; // For population of buffer
uint32_t nBytes ; // Number of bytes in buffer
hzEcode rc = E_OK ; // Return code
// m_Temp.Clear() ;
if (Z.Size())
{
m_Lock.Lock() ;
_logrotate() ;
if (m_bVerbose)
{
std::cout.write(m_pDataPtr, nBytes) ;
fflush(stdout) ;
}
zi = Z ;
for (; rc == E_OK ;)
{
for (i = m_pDataPtr, nBytes = 0; !zi.eof() && nBytes < HZ_LOGCHUNK ; nBytes++, zi++)
*i++ = *zi ;
if (!nBytes)
break ;
m_pDataPtr[nBytes] = 0;
rc = _write(nBytes) ;
}
m_Lock.Unlock() ;
}
return *this ;
}