Return Type | Function name | Arguments |
---|---|---|
hzEcode | hzLogger::Log | (const hzChain&,) |
Declared in file: hzProcess.h
Defined in file : hzLogger.cpp
Function Logic:
Function body:
hzEcode hzLogger::Log (const hzChain& Z) { hzChain::Iter zi ; char* i ; int32_t n ; uint32_t nBytes ; hzEcode rc = E_OK ; if (Z.Size()) { m_Lock.Lock() ; _logrotate() ; if (m_bVerbose) { for (n = m_nIndent ; n ; n--) printf("\t") ; printf("T%uL%d: %04d/%02d/%02d-%02d:%02d:%02d.%06d %s:\t", _hzGlobal_currProc->GetId(), _hzGlobal_currProc->Level(), m_datCurr.Year(), m_datCurr.Month(), m_datCurr.Day(), m_datCurr.Hour(), m_datCurr.Min(), m_datCurr.Sec(), m_datCurr.uSec(), _hzGlobal_currProc->GetCurrFunc()) ; std::cout << Z ; } for (n = m_nIndent ; n ; n--) fprintf(m_pFile, "\t") ; fprintf(m_pFile, "T%uL%d: %04d/%02d/%02d-%02d:%02d:%02d.%06d %s:\t", _hzGlobal_currProc->GetId(), _hzGlobal_currProc->Level(), m_datCurr.Year(), m_datCurr.Month(), m_datCurr.Day(), m_datCurr.Hour(), m_datCurr.Min(), m_datCurr.Sec(), m_datCurr.uSec(), _hzGlobal_currProc->GetCurrFunc()) ; for (zi = Z ; rc == E_OK && !zi.eof() ;) { 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 rc ; }