1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/target/CommitLog.h
12 #ifndef ZYPP_TARGET_COMMITLOG_H
13 #define ZYPP_TARGET_COMMITLOG_H
17 #include "zypp/Pathname.h"
22 ///////////////////////////////////////////////////////////////////
24 // CLASS NAME : CommitLog
26 * Simple wrapper for progress log. Refcnt, filename and corresponding
27 * ofstream are static members. Logfile constructor raises, destructor
28 * lowers refcounter. On refcounter changing from 0->1, file is opened.
29 * Changing from 1->0 the file is closed. Thus Logfile objects should be
30 * local to those functions, writing the log, and must not be stored
36 * CommitLog progresslog;
38 * progresslog() << "some message" << endl;
43 CommitLog( const CommitLog & );
44 CommitLog & operator=( const CommitLog & );
46 static std::ofstream _log;
47 static unsigned _refcnt;
48 static Pathname _fname;
50 static void openLog();
51 static void closeLog();
53 static void refDown();
55 CommitLog() { refUp(); }
56 ~CommitLog() { refDown(); }
57 std::ostream & operator()( bool timestamp = false );
58 static void setFname( const Pathname & fname_r );
59 static const Pathname & fname();
61 ///////////////////////////////////////////////////////////////////
67 #endif // ZYPP_TARGET_COMMITLOG_H