148 int code()
const {
return _code;}
155 int type()
const {
return (_code >> 16);}
169 int when()
const {
return _when;}
183 std::string
text()
const;
192 std::vector<log_entry> _entries;
194 unsigned int _counts[2];
209 bool bad()
const {
return _bad;}
218 void message(
LogCode code,
const char *param1 = 0,
const char *param2 = 0);
234 void message(
LogCode code,
const std::string ¶m1,
const std::string ¶m2) {
message(code, param1.c_str(), param2.c_str());}
243 unsigned int size()
const {
return _entries.size();}
245 unsigned int errors()
const {
return _counts[0];}
255 friend std::ostream &
operator<<(std::ostream &stream,
const log &olog);
258 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:175
int type() const
Log entry type.
Definition: log.h:155
~log_entry()
Destroy entry freeing memory.
Definition: log.cc:148
log_entry()
Construct uninitialised log entry.
Definition: log.cc:136
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:234
void message(LogCode code, const std::string ¶m)
Add a new entry to the log from a standard string.
Definition: log.h:226
unsigned int errors() const
Number of errors.
Definition: log.h:245
std::vector< log_entry >::const_iterator const_iterator
Iterator type for the log entries.
Definition: log.h:237
int code() const
Log entry error code.
Definition: log.h:148
const_iterator begin() const
Iterator to first log entry.
Definition: log.h:239
friend std::ostream & operator<<(std::ostream &stream, const log &olog)
Output log as text.
Definition: log.cc:256
const log_entry & entry(int index) const
Return entry for a given index.
Definition: log.h:252
log_entry & operator=(const log_entry &other)
Assignment.
Definition: log.cc:154
const_iterator end() const
Iterator to last log entry.
Definition: log.h:241
log()
Construct an empty log.
Definition: log.cc:237
int sub_code() const
Log entry sub code.
Definition: log.h:162
std::string text() const
Description of this log entry.
Definition: log.cc:189
Class to log actions that occur in LibPkg.
Definition: log.h:189
const log_entry & operator[](int index) const
Return entry for a given index.
Definition: log.h:250
void message(LogCode code, const char *param1=0, const char *param2=0)
Add a new entry to the log.
Definition: log.cc:242
unsigned int size() const
Total number of entries.
Definition: log.h:243
std::string when_text() const
Time of log entry as text.
Definition: log.cc:174
unsigned int warnings() const
Number of warnings.
Definition: log.h:247
A class to represent one log entry.
Definition: log.h:104
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:169
bool bad() const
The log failed to add one or more items.
Definition: log.h:209