35 inline string timestamp()
38 inline string userAtHostname()
42 char * tmp = ::cuserid(buf);
46 if (!::gethostname(buf, 255))
47 result +=
"@" + string(buf);
52 static std::string pidAndAppname()
54 static std::string _val;
57 pid_t mypid = getpid();
63 _val += myname.basename();
73 const char _sep =
'|';
77 Pathname _fnameLastFail;
85 _log.open( _fname.asString().c_str(), std::ios::out|std::ios::app );
86 if( !_log && _fnameLastFail != _fname )
88 ERR <<
"Could not open logfile '" << _fname <<
"'" << endl;
89 _fnameLastFail = _fname;
93 inline void closeLog()
106 inline void refDown()
133 if ( ! rootdir.absolute() )
141 MIL <<
"installation log file " << _fname << endl;
149 if ( _fname.empty() )
163 _log << ::timestamp() <<
" ";
165 const char * s = comment.c_str();
167 unsigned size = comment.size();
170 if (comment[size-1] ==
'\n')
173 for (
unsigned i = 0; i < size; ++i, ++c )
176 _log << string( s, c + 1 - s ) <<
"# ";
181 _log << std::string( s, c-s );
198 << _sep << p->edition()
199 << _sep << p->arch();
203 _log << _sep << userAtHostname();
205 _log << _sep << pidAndAppname();
210 << _sep << p->repoInfo().alias()
211 << _sep << p->checksum().checksum()
227 << _sep << p->edition()
228 << _sep << p->arch();
232 _log << _sep << userAtHostname();
234 _log << _sep << pidAndAppname();
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
std::string alias() const
unique identifier for this source.
static ZConfig & instance()
Singleton ctor.
int readlink(const Pathname &symlink_r, Pathname &target_r)
Like 'readlink'.
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
std::string escape(const C_Str &str_r, const char sep_r)
Escape desired character c using a backslash.
static const HistoryActionID REMOVE
What is known about a repository.
static const HistoryActionID REPO_CHANGE_ALIAS
void install(const PoolItem &pi)
Log installation (or update) of a package.
static const HistoryActionID INSTALL
Pathname historyLogFile() const
Path where ZYpp install history is logged.
ResObject::constPtr resolvable() const
Returns the ResObject::constPtr.
void removeRepository(const RepoInfo &repo)
Log recently removed repository.
static const Pathname & fname()
Get the current log file path.
const std::string & asString(bool pad=false) const
static const HistoryActionID REPO_REMOVE
ResStatus & status() const
Returns the current status.
void addRepository(const RepoInfo &repo)
Log a newly added repository.
static const HistoryActionID REPO_CHANGE_URL
bool isByApplHigh() const
std::string numstring(char n, int w=0)
static void setRoot(const Pathname &root)
Set new root directory to the default history log file path.
std::string form(const std::string &format_r) const
Return string representation according to format as localtime.
static const HistoryActionID REPO_ADD
static Date now()
Return the current time.
void remove(const PoolItem &pi)
Log removal of a package.
std::string userData() const
User defined string value to be passed to log, history, plugins...
void comment(const std::string &comment, bool timestamp=false)
Log a comment (even multiline).
Reference to a PoolItem connecting ResObject and ResStatus.
void modifyRepository(const RepoInfo &oldrepo, const RepoInfo &newrepo)
Log certain modifications to a repository.
#define HISTORY_LOG_DATE_FORMAT
HistoryLog(const HistoryLog &)
TraitsType::constPtrType constPtr