1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/target/CommitLog.cc
15 #include "zypp/base/Logger.h"
17 #include "zypp/target/CommitLog.h"
18 #include "zypp/PathInfo.h"
19 #include "zypp/Date.h"
26 ///////////////////////////////////////////////////////////////////
28 Pathname CommitLog::_fname;
29 std::ofstream CommitLog::_log;
30 unsigned CommitLog::_refcnt = 0;
32 ///////////////////////////////////////////////////////////////////
34 void CommitLog::openLog() {
35 if ( !_fname.empty() ) {
37 _log.open( _fname.asString().c_str(), std::ios::out|std::ios::app );
39 ERR << "Could not open logfile '" << _fname << "'" << endl;
42 void CommitLog::closeLog() {
46 void CommitLog::refUp() {
51 void CommitLog::refDown() {
57 std::ostream & CommitLog::operator()( bool timestamp ) {
59 _log << Date(Date::now()).form( "%Y-%m-%d %H:%M:%S ");
64 void CommitLog::setFname( const Pathname & fname_r ) {
65 MIL << "installation log file " << fname_r << endl;
69 if ( ! _fname.empty() )
70 filesystem::assert_dir( _fname.dirname() );
75 const Pathname & CommitLog::fname()