Back to index

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

#include <logger.h>

Inheritance diagram for Logger:
Inheritance graph
[legend]
Collaboration diagram for Logger:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Logger ()
 ~Logger ()
BOOL init ()
void shut ()
virtual BOOL platformInit ()=0
virtual void platformShut ()=0
virtual void dumpStringToMainWindow (char *string)=0
void setOnTop (BOOL ontop)
void setToFile (BOOL tofile, char *filename)
BOOLgetMutedCalls ()
void setMutedCalls (BOOL *mutedcalls)
BOOL isMuted (NPAPI_Action action)
void logNS_NP_GetEntryPoints ()
void logNS_NP_Initialize ()
void logNS_NP_Shutdown ()
void logSPY_NP_GetEntryPoints (NPPluginFuncs *pNPPFuncs)
void logSPY_NP_Initialize ()
void logSPY_NP_Shutdown (char *mimetype)
void logCall (NPAPI_Action action, DWORD dw1=0L, DWORD dw2=0L, DWORD dw3=0L, DWORD dw4=0L, DWORD dw5=0L, DWORD dw6=0L, DWORD dw7=0L)
void logReturn (DWORD dwRet=0L)

Public Attributes

BOOL bMutedAll
BOOL bToWindow
BOOL bToConsole
BOOL bToFile
BOOL bOnTop
BOOL bSPALID
CLogFile filer
BOOL bSaveSettings
char szFile [_MAX_PATH]
BOOL bMutedCalls [TOTAL_NUMBER_OF_API_CALLS]

Detailed Description

Definition at line 48 of file logger.h.


Constructor & Destructor Documentation

Definition at line 44 of file logger.cpp.

Here is the call graph for this function:

Definition at line 68 of file logger.cpp.

{
}

Member Function Documentation

virtual void Logger::dumpStringToMainWindow ( char *  string) [pure virtual]

Implemented in LoggerWin.

Here is the caller graph for this function:

Definition at line 386 of file logger.cpp.

{
  return &bMutedCalls[0];
}

Here is the caller graph for this function:

Definition at line 72 of file logger.cpp.

{
  if(bToFile)
    filer.create(szFile, TRUE);

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 372 of file logger.cpp.

{
  if(bMutedAll)
    return TRUE;

  if(action >= TOTAL_NUMBER_OF_API_CALLS)
  {
    assert(0);
    return FALSE;
  }

  return bMutedCalls[action];
}

Here is the caller graph for this function:

void Logger::logCall ( NPAPI_Action  action,
DWORD  dw1 = 0L,
DWORD  dw2 = 0L,
DWORD  dw3 = 0L,
DWORD  dw4 = 0L,
DWORD  dw5 = 0L,
DWORD  dw6 = 0L,
DWORD  dw7 = 0L 
)

Definition at line 302 of file logger.cpp.

{
  if(isMuted(action))
    return;

  static char szLog[512];

  LogItemStruct * lis = makeLogItemStruct(action, dw1, dw2, dw3, dw4, dw5, dw6, dw7);
  int iLength = formatLogItem(lis, szLog, TRUE);
  freeLogItemStruct(lis);

  if(bToConsole)
    printf("%s", szLog);
  
  if(bToFile)
    filer.write(szLog);

  if(bToWindow)
    dumpStringToMainWindow(szLog);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 87 of file logger.cpp.

{
  char szLog[] = "NP_GetEntryPoints by Netscape\r\n";

  if(bToConsole)
    printf("%s", szLog);
  
  if(bToFile)
    filer.write(szLog);

  if(bToWindow)
    dumpStringToMainWindow(szLog);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 101 of file logger.cpp.

{
  char szLog[] = "NP_Initialize by Netscape\r\n";

  if(bToConsole)
    printf("%s", szLog);
  
  if(bToFile)
    filer.write(szLog);

  if(bToWindow)
    dumpStringToMainWindow(szLog);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 115 of file logger.cpp.

{
  char szLog[] = "NP_Shutdown by Netscape\r\n";

  if(bToConsole)
    printf("%s", szLog);
  
  if(bToFile)
    filer.write(szLog);

  if(bToWindow)
    dumpStringToMainWindow(szLog);
}

Here is the call graph for this function:

void Logger::logReturn ( DWORD  dwRet = 0L)

Definition at line 323 of file logger.cpp.

{
}

Here is the caller graph for this function:

Definition at line 129 of file logger.cpp.

{
  char szLog[80] = "NP_GetEntryPoints by NPSpy\r\n";

  if(bToConsole)
    printf("%s", szLog);
  
  if(bToFile)
    filer.write(szLog);

  if(bToWindow)
    dumpStringToMainWindow(szLog);

  if(!pNPPFuncs)
    return;

  char szLog1[80],szLog2[80],szLog3[80],szLog4[80],szLog5[80],szLog6[80],szLog7[80],
       szLog8[80],szLog9[80],szLog10[80],szLog11[80],szLog12[80],szLog13[80],szLog14[80],
       szLog15[80],szLog16[80],szLog17[80],szLog18[80],szLog19[80],szLog20[80];

  sprintf(szLog1, "\r\n");
  sprintf(szLog2, "     Plugin entry point table\r\n");
  sprintf(szLog3, "     ========================\r\n");

  if(pNPPFuncs->size)
    sprintf(szLog4, "    size          = %i\r\n", pNPPFuncs->size);
  else
    sprintf(szLog4, "    size          = not set!\r\n");

  if(pNPPFuncs->version)
    sprintf(szLog5, "    version       = %i\r\n", pNPPFuncs->version);
  else
    sprintf(szLog5, "    version       = not set!\r\n");
  
  if(pNPPFuncs->newp)
    sprintf(szLog6, "    newp          = %#08lx\r\n", pNPPFuncs->newp);
  else
    sprintf(szLog6, "    newp          = not set!\r\n");
  
  if(pNPPFuncs->destroy)
    sprintf(szLog7, "    destroy       = %#08lx\r\n", pNPPFuncs->destroy);
  else
    sprintf(szLog7, "    destroy       = not set!\r\n");
  
  if(pNPPFuncs->setwindow)
    sprintf(szLog8, "    setwindow     = %#08lx\r\n", pNPPFuncs->setwindow);
  else
    sprintf(szLog8, "    setwindow     = not set!\r\n");
  
  if(pNPPFuncs->newstream)
    sprintf(szLog9, "    newstream     = %#08lx\r\n", pNPPFuncs->newstream);
  else
    sprintf(szLog9, "    newstream     = not set!\r\n");
  
  if(pNPPFuncs->destroystream)
    sprintf(szLog10, "    destroystream = %#08lx\r\n", pNPPFuncs->destroystream);
  else
    sprintf(szLog10, "    destroystream = not set!\r\n");
  
  if(pNPPFuncs->asfile)
    sprintf(szLog11, "    asfile        = %#08lx\r\n", pNPPFuncs->asfile);
  else
    sprintf(szLog11, "    asfile        = not set!\r\n");
  
  if(pNPPFuncs->writeready)
    sprintf(szLog12, "    writeready    = %#08lx\r\n", pNPPFuncs->writeready);
  else
    sprintf(szLog12, "    writeready    = not set!\r\n");
  
  if(pNPPFuncs->write)
    sprintf(szLog13, "    write         = %#08lx\r\n", pNPPFuncs->write);
  else
    sprintf(szLog13, "    write         = not set!\r\n");
  
  if(pNPPFuncs->print)
    sprintf(szLog14, "    print         = %#08lx\r\n", pNPPFuncs->print);
  else
    sprintf(szLog14, "    print         = not set!\r\n");
  
  if(pNPPFuncs->event)
    sprintf(szLog15, "    event         = %#08lx\r\n", pNPPFuncs->event);
  else
    sprintf(szLog15, "    event         = not set!\r\n");
  
  if(pNPPFuncs->urlnotify)
    sprintf(szLog16, "    urlnotify     = %#08lx\r\n", pNPPFuncs->urlnotify);
  else
    sprintf(szLog16, "    urlnotify     = not set!\r\n");
  
  if(pNPPFuncs->javaClass)
    sprintf(szLog17, "    javaClass     = %#08lx\r\n", pNPPFuncs->javaClass);
  else
    sprintf(szLog17, "    javaClass     = not set!\r\n");
  
  if(pNPPFuncs->getvalue)
    sprintf(szLog18, "    getvalue      = %#08lx\r\n", pNPPFuncs->getvalue);
  else
    sprintf(szLog18, "    getvalue      = not set!\r\n");
  
  if(pNPPFuncs->setvalue)
    sprintf(szLog19, "    setvalue      = %#08lx\r\n", pNPPFuncs->setvalue);
  else
    sprintf(szLog19, "    setvalue      = not set!\r\n");

  sprintf(szLog20, "\r\n");

  if(bToConsole)
  {
    printf("%s", szLog1); printf("%s", szLog2); printf("%s", szLog3); printf("%s", szLog4);
    printf("%s", szLog5); printf("%s", szLog6); printf("%s", szLog7); printf("%s", szLog8);
    printf("%s", szLog9); printf("%s", szLog10); printf("%s", szLog11); printf("%s", szLog12);
    printf("%s", szLog13); printf("%s", szLog14); printf("%s", szLog15); printf("%s", szLog16);
    printf("%s", szLog17); printf("%s", szLog18); printf("%s", szLog19); printf("%s", szLog20);
  }
  
  if(bToFile)
  {
    filer.write(szLog1); filer.write(szLog2); filer.write(szLog3); filer.write(szLog4);
    filer.write(szLog5); filer.write(szLog6); filer.write(szLog7); filer.write(szLog8);
    filer.write(szLog9); filer.write(szLog10); filer.write(szLog11); filer.write(szLog12);
    filer.write(szLog13); filer.write(szLog14); filer.write(szLog15); filer.write(szLog16);
    filer.write(szLog17); filer.write(szLog18); filer.write(szLog19); filer.write(szLog20);
  }
  
  if(bToWindow)
  {
    dumpStringToMainWindow(szLog1); dumpStringToMainWindow(szLog2);
    dumpStringToMainWindow(szLog3); dumpStringToMainWindow(szLog4);
    dumpStringToMainWindow(szLog5); dumpStringToMainWindow(szLog6);
    dumpStringToMainWindow(szLog7); dumpStringToMainWindow(szLog8);
    dumpStringToMainWindow(szLog9); dumpStringToMainWindow(szLog10);
    dumpStringToMainWindow(szLog11); dumpStringToMainWindow(szLog12);
    dumpStringToMainWindow(szLog13); dumpStringToMainWindow(szLog14);
    dumpStringToMainWindow(szLog15); dumpStringToMainWindow(szLog16);
    dumpStringToMainWindow(szLog17); dumpStringToMainWindow(szLog18);
    dumpStringToMainWindow(szLog19); dumpStringToMainWindow(szLog20);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 268 of file logger.cpp.

{
  char szLog[] = "NP_Initialize by NPSpy\r\n";

  if(bToConsole)
    printf("%s", szLog);
  
  if(bToFile)
    filer.write(szLog);

  if(bToWindow)
    dumpStringToMainWindow(szLog);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Logger::logSPY_NP_Shutdown ( char *  mimetype)

Definition at line 282 of file logger.cpp.

{
  char szLog[512] = "NP_Shutdown by NPSpy\r\n";
  if(mimetype)
  {
    strcat(szLog, " for \"");
    strcat(szLog, mimetype);
    strcat(szLog, "\"");
  }

  if(bToConsole)
    printf("%s", szLog);
  
  if(bToFile)
    filer.write(szLog);

  if(bToWindow)
    dumpStringToMainWindow(szLog);
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual BOOL Logger::platformInit ( ) [pure virtual]

Implemented in LoggerWin.

Here is the caller graph for this function:

virtual void Logger::platformShut ( ) [pure virtual]

Implemented in LoggerWin.

Here is the caller graph for this function:

void Logger::setMutedCalls ( BOOL mutedcalls)

Definition at line 391 of file logger.cpp.

{
  for(int i = 0; i < sizeof(bMutedCalls)/sizeof(BOOL); i++)
    bMutedCalls[i] = mutedcalls[i];
}

Here is the caller graph for this function:

Definition at line 327 of file logger.cpp.

{
  bOnTop = ontop;
}
void Logger::setToFile ( BOOL  tofile,
char *  filename 
)

Definition at line 332 of file logger.cpp.

{
  if(!filename || !*filename || (strlen(filename) > _MAX_PATH))
  {
    bToFile = FALSE;
    return;
  }

  //don't screw up the file on false call
  BOOL samefile = (stricmp(szFile, filename) == 0);
  BOOL sameaction = (bToFile == tofile);
  
  if(sameaction)
  {
    if(samefile)
      return;

    strcpy(szFile, filename);

    if(bToFile)
    {
      filer.close();
      filer.create(szFile, TRUE);
    }
  }

  if(!sameaction)
  {
    bToFile = tofile;

    if(!samefile)
      strcpy(szFile, filename);

    if(bToFile)
      filer.create(szFile, TRUE);
    else
      filer.close();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 80 of file logger.cpp.

{
  filer.close();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 51 of file logger.h.

Definition at line 65 of file logger.h.

Definition at line 55 of file logger.h.

Reimplemented in LoggerWin.

Definition at line 60 of file logger.h.

Definition at line 56 of file logger.h.

Definition at line 53 of file logger.h.

Definition at line 54 of file logger.h.

Definition at line 52 of file logger.h.

Definition at line 58 of file logger.h.

Definition at line 61 of file logger.h.


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