1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/target/HistoryLog.h
12 #ifndef ZYPP_TARGET_COMMITLOG_H
13 #define ZYPP_TARGET_COMMITLOG_H
17 #include "zypp/Pathname.h"
24 ///////////////////////////////////////////////////////////////////
26 /// \brief Writing the zypp history file
27 /// \ingroup g_ZyppHistory
29 /// Reference counted signleton for writhing the zypp history file.
30 /// The history file is opened on demand and closed when the last
31 /// HistoryLog object drops its reference. Thus HistoryLog objects
32 /// should be local to those functions, writing the log, and must
33 /// not be stored permanently.
40 /// HistoryLog().install(pi);
42 /// HistoryLog().comment(someMessage);
46 /// \note Take care to set proper target root dir if needed. Either pass
47 /// it via the constructor, or set it via setRoot(Pathname) method.
48 /// The default location of the file is determined by
49 /// \ref zypp::ZConfig::historyLogPath (default: \c /var/log/zypp/history).
51 /// \todo The implementation as pseudo signleton is questionable.
52 /// Use shared_ptr instead of handcrafted ref/unref. Manage multiple
53 /// logs at different locations.
54 ///////////////////////////////////////////////////////////////////
57 HistoryLog( const HistoryLog & );
58 HistoryLog & operator=( const HistoryLog & );
61 * Constructor with an optional root directory.
63 * \param rootdir actual target root directory
65 HistoryLog( const Pathname & rootdir = Pathname() );
69 * Set new root directory to the default history log file path.
71 * This path will be prepended to the default log file path. This should
72 * be done where there is a potential that the target root has changed.
74 * \param root new root directory.
76 static void setRoot( const Pathname & root );
79 * Get the current log file path.
81 static const Pathname & fname();
84 * Log a comment (even multiline).
86 * \param comment the comment
87 * \param timestamp whether to include a timestamp at the start of the comment
89 void comment( const std::string & comment, bool timestamp = false );
92 * Log installation (or update) of a package.
94 void install( const PoolItem & pi );
97 * Log removal of a package
99 void remove( const PoolItem & pi );
102 * Log a newly added repository.
104 * \param repo info about the added repository
106 void addRepository( const RepoInfo & repo );
109 * Log recently removed repository.
111 * \param repo info about the removed repository
113 void removeRepository( const RepoInfo & repo );
116 * Log certain modifications to a repository.
118 * \param oldrepo info about the old repository
119 * \param newrepo info about the new repository
121 void modifyRepository( const RepoInfo & oldrepo, const RepoInfo & newrepo );
123 ///////////////////////////////////////////////////////////////////
127 #endif // ZYPP_TARGET_COMMITLOG_H