Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Member Functions | Private Attributes
xptiAutoLog Class Reference

#include <xptiprivate.h>

Collaboration diagram for xptiAutoLog:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 xptiAutoLog ()
 xptiAutoLog (xptiInterfaceInfoManager *mgr, nsILocalFile *logfile, PRBool append)
 ~xptiAutoLog ()

Private Member Functions

void WriteTimestamp (PRFileDesc *fd, const char *msg)

Private Attributes

xptiInterfaceInfoManagermMgr
PRFileDescmOldFileDesc

Detailed Description

Definition at line 841 of file xptiprivate.h.


Constructor & Destructor Documentation

Definition at line 76 of file xptiMisc.cpp.

    : mMgr(nsnull), mOldFileDesc(nsnull)
{
    MOZ_COUNT_CTOR(xptiAutoLog);

    if(mgr && logfile)
    {
        PRFileDesc* fd;
        if(NS_SUCCEEDED(logfile->
                    OpenNSPRFileDesc(PR_WRONLY | PR_CREATE_FILE | PR_APPEND |
                                             (append ? 0 : PR_TRUNCATE),
                                             0666, &fd)) && fd)
        {
#ifdef DEBUG
            m_DEBUG_FileDesc = fd;
#endif
            mMgr = mgr;
            mOldFileDesc = mMgr->SetOpenLogFile(fd);
            if(append)
                PR_Seek(fd, 0, PR_SEEK_END);
            WriteTimestamp(fd, "++++ start logging ");

        }
        else
        {
#ifdef DEBUG
        printf("xpti failed to open log file for writing\n");
#endif
        }
    }
}

Definition at line 109 of file xptiMisc.cpp.

{
    MOZ_COUNT_DTOR(xptiAutoLog);

    if(mMgr)
    {
        PRFileDesc* fd = mMgr->SetOpenLogFile(mOldFileDesc);
        NS_ASSERTION(fd == m_DEBUG_FileDesc, "bad unravel");
        if(fd)
        {
            WriteTimestamp(fd, "---- end logging   ");
            PR_Close(fd);
        }
    }
}

Here is the call graph for this function:


Member Function Documentation

void xptiAutoLog::WriteTimestamp ( PRFileDesc fd,
const char *  msg 
) [private]

Definition at line 125 of file xptiMisc.cpp.

{
    PRExplodedTime expTime;
    PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &expTime);
    char time[128];
    PR_FormatTimeUSEnglish(time, 128, "%Y-%m-%d-%H:%M:%S", &expTime);
    PR_fprintf(fd, "\n%s %s\n\n", msg, time);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 851 of file xptiprivate.h.

Definition at line 852 of file xptiprivate.h.


The documentation for this class was generated from the following files: