zypp::target::CommitLog Class Reference

Simple wrapper for progress log. More...

#include <CommitLog.h>

List of all members.

Public Member Functions

 CommitLog ()
 ~CommitLog ()
std::ostream & operator() (bool timestamp=false)

Static Public Member Functions

static void setFname (const Pathname &fname_r)

Private Member Functions

 CommitLog (const CommitLog &)
CommitLogoperator= (const CommitLog &)

Static Private Member Functions

static void openLog ()
static void closeLog ()
static void refUp ()
static void refDown ()

Static Private Attributes

static std::ofstream _log
static unsigned _refcnt = 0
static Pathname _fname


Detailed Description

Simple wrapper for progress log.

Refcnt, filename and corresponding ofstream are static members. Logfile constructor raises, destructor lowers refcounter. On refcounter changing from 0->1, file is opened. Changing from 1->0 the file is closed. Thus Logfile objects should be local to those functions, writing the log, and must not be stored permanently;

Usage: some methothd () { CommitLog progresslog; ... progresslog() << "some message" << endl; ... }

Definition at line 42 of file CommitLog.h.


Constructor & Destructor Documentation

zypp::target::CommitLog::CommitLog ( const CommitLog  )  [private]

zypp::target::CommitLog::CommitLog (  )  [inline]

Definition at line 55 of file CommitLog.h.

References refUp().

zypp::target::CommitLog::~CommitLog (  )  [inline]

Definition at line 56 of file CommitLog.h.

References refDown().


Member Function Documentation

CommitLog& zypp::target::CommitLog::operator= ( const CommitLog  )  [private]

void zypp::target::CommitLog::openLog (  )  [static, private]

Definition at line 33 of file CommitLog.cc.

References _fname, _log, and ERR.

Referenced by refUp(), and setFname().

void zypp::target::CommitLog::closeLog (  )  [static, private]

Definition at line 41 of file CommitLog.cc.

References _log.

Referenced by refDown(), and setFname().

void zypp::target::CommitLog::refUp (  )  [static, private]

Definition at line 45 of file CommitLog.cc.

References _refcnt, and openLog().

Referenced by CommitLog().

void zypp::target::CommitLog::refDown (  )  [static, private]

Definition at line 50 of file CommitLog.cc.

References _refcnt, and closeLog().

Referenced by ~CommitLog().

std::ostream & zypp::target::CommitLog::operator() ( bool  timestamp = false  ) 

Definition at line 56 of file CommitLog.cc.

References _log, and zypp::Date::now().

void zypp::target::CommitLog::setFname ( const Pathname &  fname_r  )  [static]

Definition at line 63 of file CommitLog.cc.

References _fname, _refcnt, closeLog(), MIL, and openLog().

Referenced by zypp::target::TargetImpl::setInstallationLogfile().


Member Data Documentation

std::ofstream zypp::target::CommitLog::_log [static, private]

Definition at line 46 of file CommitLog.h.

Referenced by closeLog(), openLog(), and operator()().

unsigned zypp::target::CommitLog::_refcnt = 0 [static, private]

Definition at line 47 of file CommitLog.h.

Referenced by refDown(), refUp(), and setFname().

Pathname zypp::target::CommitLog::_fname [static, private]

Definition at line 48 of file CommitLog.h.

Referenced by openLog(), and setFname().


The documentation for this class was generated from the following files:
Generated on Tue Sep 25 19:23:28 2007 for libzypp by  doxygen 1.5.3