Purpose: Open a LogChannel to use a file regime
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hzLogger::OpenFile | (const char*,hzLogRotate,) |
Declared in file: hzProcess.h
Defined in file : hzLogger.cpp
Function Logic:
Function body:
hzEcode hzLogger::OpenFile (const char* fpath)hzLogRotate eRotate,
{
// Purpose: Open a LogChannel to use a file regime
//
// Arguments: 1) fpath The logfile's base name or path
// 2) eRotate The log rotate edict
//
// Returns: E_ARGUMENT If no file path is supplied
// E_INITDUP If logger already open
// E_OK If channel opened OK
_hzfunc("hzLogger::OpenFile") ;
char cvDir [HZ_MAXPATHLEN] ; // Current working directory
char* cpCWD ; // Path iterator
if (!fpath || !fpath[0])
hzexit(E_ARGUMENT, "No path supplied") ;
if (IsOpen())
hzexit(E_INITDUP, "%s: This log channel is already open", fpath) ;
if (fpath[0]== CHAR_FWSLASH)
m_Base = fpath ;
else
{
cpCWD = getcwd(cvDir, HZ_MAXPATHLEN) ;
for (; *cpCWD ; cpCWD++) ;
*cpCWD++ = CHAR_FWSLASH ;
strcpy(cpCWD, fpath) ;
m_Base = cvDir ;
}
// Set this to non zero to indicate channel open
m_nSessID = 0;
// Set rotate edict
m_eRotate = eRotate ;
// Set data pointer
m_pDataPtr = m_cvData ;
return E_OK ;
}