Source Code (Use browser search to find items of interest.)

Class Index

kimageshop'KisLog (./koffice/kimageshop/core/kis_log.h:27)

class KisLog
{
public:
  KisLog() {}

  // write log output to a file instead of cerr
  static void setLogFile(const char *file);

  static ostream &output() { return *m_output; };

private:

  static ostream *m_output;
  static char    *m_logfile;

};


kimageshop'KisLog::setLogFile() (./koffice/kimageshop/core/kis_log.cc:33)

void KisLog::setLogFile(const char *file)
{
  // remove old logfile
  ::unlink(file);

  // delete old output stream
  if (m_logfile)
      delete m_output;

  // open new output
  m_output = new ofstream(file, ofstream::app);
  m_logfile = strdup(file);
  
  // fall back to cerr
  if (!m_output)
    {
      m_output = &cerr;
      m_logfile = 0;
    }
}