165 int code()
const {
return _code; }
172 int type()
const {
return (_code >> 16); }
186 int when()
const {
return _when; }
200 std::string
text()
const;
209 std::vector<log_entry> _entries;
211 unsigned int _counts[2];
226 bool bad()
const {
return _bad; }
235 void message(
LogCode code,
const char *param1 = 0,
const char *param2 = 0);
251 void message(
LogCode code,
const std::string ¶m1,
const std::string ¶m2) {
message(code, param1.c_str(), param2.c_str()); }
260 unsigned int size()
const {
return _entries.size(); }
262 unsigned int errors()
const {
return _counts[0]; }
264 unsigned int warnings()
const {
return _counts[1]; }
272 friend std::ostream &
operator<<(std::ostream &stream,
const log &olog);
275 std::ostream &
operator<<(std::ostream &stream,
const log &olog);
std::ostream & operator<<(std::ostream &out, const component &comp)
Write component record to output stream.
Definition: component.cc:179
int type() const
Log entry type.
Definition: log.h:172
~log_entry()
Destroy entry freeing memory.
Definition: log.cc:164
log_entry()
Construct uninitialised log entry.
Definition: log.cc:152
void message(LogCode code, const std::string ¶m1, const std::string ¶m2)
Add a new entry to the log from two standard strings.
Definition: log.h:251
void message(LogCode code, const std::string ¶m)
Add a new entry to the log from a standard string.
Definition: log.h:243
unsigned int errors() const
Number of errors.
Definition: log.h:262
std::vector< log_entry >::const_iterator const_iterator
Iterator type for the log entries.
Definition: log.h:254
int code() const
Log entry error code.
Definition: log.h:165
const_iterator begin() const
Iterator to first log entry.
Definition: log.h:256
friend std::ostream & operator<<(std::ostream &stream, const log &olog)
Output log as text.
Definition: log.cc:274
const log_entry & entry(int index) const
Return entry for a given index.
Definition: log.h:269
log_entry & operator=(const log_entry &other)
Assignment.
Definition: log.cc:170
const_iterator end() const
Iterator to last log entry.
Definition: log.h:258
log()
Construct an empty log.
Definition: log.cc:254
int sub_code() const
Log entry sub code.
Definition: log.h:179
std::string text() const
Description of this log entry.
Definition: log.cc:205
Class to log actions that occur in LibPkg.
Definition: log.h:206
const log_entry & operator[](int index) const
Return entry for a given index.
Definition: log.h:267
void message(LogCode code, const char *param1=0, const char *param2=0)
Add a new entry to the log.
Definition: log.cc:259
unsigned int size() const
Total number of entries.
Definition: log.h:260
std::string when_text() const
Time of log entry as text.
Definition: log.cc:190
unsigned int warnings() const
Number of warnings.
Definition: log.h:264
A class to represent one log entry.
Definition: log.h:121
LogCode
An enumeration of all the items that can be logged.
Definition: log.h:19
int when() const
Time since midnight of log entry.
Definition: log.h:186
bool bad() const
The log failed to add one or more items.
Definition: log.h:226