|
apt 3.0.3
commandline package manager
|
Public Types | |
| enum | MsgType { FATAL = 40 , ERROR = 30 , WARNING = 20 , NOTICE = 10 , AUDIT = 5 , DEBUG = 0 } |
| a message can have one of following severity More... | |
Public Member Functions | |
| bool | FatalE (const char *Function, const char *Description,...) APT_PRINTF(3) APT_COLD |
| add a fatal error message with errno to the list | |
| bool | Errno (const char *Function, const char *Description,...) APT_PRINTF(3) APT_COLD |
| add an Error message with errno to the list | |
| bool | WarningE (const char *Function, const char *Description,...) APT_PRINTF(3) APT_COLD |
| add a warning message with errno to the list | |
| bool | NoticeE (const char *Function, const char *Description,...) APT_PRINTF(3) APT_COLD |
| add a notice message with errno to the list | |
| bool | AuditE (const char *Function, const char *Description,...) APT_PRINTF(3) APT_COLD |
| add an audit message with errno to the list | |
| bool | DebugE (const char *Function, const char *Description,...) APT_PRINTF(3) APT_COLD |
| add a debug message with errno to the list | |
| bool | InsertErrno (MsgType const &type, const char *Function, const char *Description,...) APT_PRINTF(4) APT_COLD |
| adds an errno message with the given type | |
| bool | InsertErrno (MsgType type, const char *Function, const char *Description, va_list &args, int const errsv, size_t &msgSize) APT_COLD |
| adds an errno message with the given type | |
| bool | Fatal (const char *Description,...) APT_PRINTF(2) APT_COLD |
| add an fatal error message to the list | |
| bool | Error (const char *Description,...) APT_PRINTF(2) APT_COLD |
| add an Error message to the list | |
| bool | Warning (const char *Description,...) APT_PRINTF(2) APT_COLD |
| add a warning message to the list | |
| bool | Notice (const char *Description,...) APT_PRINTF(2) APT_COLD |
| add a notice message to the list | |
| bool | Audit (const char *Description,...) APT_PRINTF(2) APT_COLD |
| add an audit message to the list | |
| bool | Debug (const char *Description,...) APT_PRINTF(2) APT_COLD |
| add a debug message to the list | |
| bool | Insert (MsgType const &type, const char *Description,...) APT_PRINTF(3) APT_COLD |
| adds an error message with the given type | |
| bool | Insert (MsgType type, const char *Description, va_list &args, size_t &msgSize) APT_COLD |
| adds an error message with the given type | |
| bool | PendingError () const APT_PURE |
| is an error in the list? | |
| bool | empty (MsgType const &threshold=WARNING) const APT_PURE |
| is the list empty? | |
| bool | PopMessage (std::string &Text) |
| returns and removes the first (or last) message in the list | |
| void | Discard () |
| clears the list of messages | |
| void | DumpErrors (std::ostream &out, MsgType const &threshold=WARNING, bool const &mergeStack=true) |
| outputs the list of messages to the given stream | |
| void | DumpErrors (MsgType const &threshold) |
| dumps the list of messages to std::cerr | |
| void | DumpErrors () |
| dumps the messages of type WARNING or higher to std::cerr | |
| void | PushToStack () |
| put the current Messages into the stack | |
| void | RevertToStack () |
| throw away all current messages | |
| void | MergeWithStack () |
| merge current and stack together | |
| size_t | StackCount () const APT_PURE |
| return the deep of the stack | |
Friends | |
| APT_HIDDEN friend std::ostream & | operator<< (std::ostream &out, Item i) |
| enum MsgType |
a message can have one of following severity
| bool Audit | ( | const char * | Description, |
| ... | |||
| ) |
add an audit message to the list
An audit message highlights divergences from best practices and future deprecations. It my for example include additional messages targeted at repository owners.
| Description | Format string for the message |
| bool AuditE | ( | const char * | Function, |
| const char * | Description, | ||
| ... | |||
| ) |
add an audit message with errno to the list
| Function | name of the function generating the error |
| Description | format string for the error message |
| bool Debug | ( | const char * | Description, |
| ... | |||
| ) |
add a debug message to the list
| Description | Format string for the message |
| bool DebugE | ( | const char * | Function, |
| const char * | Description, | ||
| ... | |||
| ) |
add a debug message with errno to the list
| Function | name of the function generating the error |
| Description | format string for the error message |
|
inline |
dumps the messages of type WARNING or higher to std::cerr
Note that all messages are discarded, displayed or not.
|
inline |
dumps the list of messages to std::cerr
Note that all messages are discarded, also the notices displayed or not.
| threshold | minimum level printed |
| void DumpErrors | ( | std::ostream & | out, |
| MsgType const & | threshold = WARNING, |
||
| bool const & | mergeStack = true |
||
| ) |
outputs the list of messages to the given stream
Note that all messages are discarded, even undisplayed ones.
| [out] | out | output stream to write the messages in |
| threshold | minimum level considered | |
| mergeStack | if true recursively dumps the entire stack |
References Discard().
is the list empty?
Can be used to check if the current stack level doesn't include anything equal or more severe than a given threshold, defaulting to warning level for historic reasons.
| threshold | minimum level considered |
| bool Errno | ( | const char * | Function, |
| const char * | Description, | ||
| ... | |||
| ) |
add an Error message with errno to the list
| Function | name of the function generating the error |
| Description | format string for the error message |
| bool Error | ( | const char * | Description, |
| ... | |||
| ) |
add an Error message to the list
| Description | Format string for the error message. |
| bool Fatal | ( | const char * | Description, |
| ... | |||
| ) |
add an fatal error message to the list
Most of the stuff we consider as "error" is also "fatal" for the user as the application will not have the expected result, but a fatal message here means that it gets printed directly to stderr in addition to adding it to the list as the error leads sometimes to crashes and a maybe duplicated message is better than "Segfault" as the only displayed text
| Description | Format string for the fatal error message. |
| bool FatalE | ( | const char * | Function, |
| const char * | Description, | ||
| ... | |||
| ) |
add a fatal error message with errno to the list
| Function | name of the function generating the error |
| Description | format string for the error message |
adds an error message with the given type
| type | of the error message |
| Description | of the error |
References Insert().
Referenced by Insert(), and InsertErrno().
| bool Insert | ( | MsgType | type, |
| const char * | Description, | ||
| va_list & | args, | ||
| size_t & | msgSize | ||
| ) |
adds an error message with the given type
args needs to be initialized with va_start and terminated with va_end by the caller. msgSize is also an out-parameter in case the msgSize was not enough to store the complete message.
| type | of the error message |
| Description | is the format string for args |
| args | list from a printf-like function |
| msgSize | is the size of the char[] used to store message |
| ERROR NOTICE DEBUG bool InsertErrno | ( | MsgType const & | type, |
| const char * | Function, | ||
| const char * | Description, | ||
| ... | |||
| ) |
adds an errno message with the given type
| type | of the error message |
| Function | which failed |
| Description | of the error |
References InsertErrno().
Referenced by InsertErrno().
| bool InsertErrno | ( | MsgType | type, |
| const char * | Function, | ||
| const char * | Description, | ||
| va_list & | args, | ||
| int const | errsv, | ||
| size_t & | msgSize | ||
| ) |
adds an errno message with the given type
args needs to be initialized with va_start and terminated with va_end by the caller. msgSize is also an out-parameter in case the msgSize was not enough to store the complete message.
| type | of the error message |
| Function | which failed |
| Description | is the format string for args |
| args | list from a printf-like function |
| errsv | is the errno the error is for |
| msgSize | is the size of the char[] used to store message |
References Insert().
| bool Notice | ( | const char * | Description, |
| ... | |||
| ) |
add a notice message to the list
A notice should be considered less severe than an error or a warning and can be ignored by the client without further problems for some times, but he should consider fixing the problem. This error type can be used for e.g. deprecation warnings of options.
| Description | Format string for the message |
| bool NoticeE | ( | const char * | Function, |
| const char * | Description, | ||
| ... | |||
| ) |
add a notice message with errno to the list
| Function | name of the function generating the error |
| Description | format string for the error message |
|
inline |
is an error in the list?
| bool PopMessage | ( | std::string & | Text | ) |
| void PushToStack | ( | ) |
put the current Messages into the stack
All "old" messages will be pushed into a stack to them later back, but for now the Message query will be empty and performs as no messages were present before.
The stack can be as deep as you want - all stack operations will only operate on the last element in the stack.
References Discard().
| bool Warning | ( | const char * | Description, |
| ... | |||
| ) |
add a warning message to the list
A warning should be considered less severe than an error and may be ignored by the client.
| Description | Format string for the message |
| bool WarningE | ( | const char * | Function, |
| const char * | Description, | ||
| ... | |||
| ) |
add a warning message with errno to the list
A warning should be considered less severe than an error and may be ignored by the client.
| Function | Name of the function generates the warning. |
| Description | Format string for the warning message. |