mirror of
https://github.com/NixOS/nix
synced 2025-06-30 11:43:15 +02:00
add some comments
This commit is contained in:
parent
721943e1d4
commit
94427ffee3
3 changed files with 42 additions and 18 deletions
|
@ -150,9 +150,23 @@ bool handleJSONLogMessage(const std::string & msg,
|
|||
|
||||
extern Verbosity verbosity; /* suppress msgs > this */
|
||||
|
||||
/* Print a message if the current log level is at least the specified
|
||||
level. Note that this has to be implemented as a macro to ensure
|
||||
that the arguments are evaluated lazily. */
|
||||
/* Print a message with the standard ErrorInfo format.
|
||||
In general, use these 'log' macros for reporting problems that may require user
|
||||
intervention or that need more explanation. Use the 'print' macros for more
|
||||
lightweight status messages. */
|
||||
#define logErrorInfo(level, errorInfo...) \
|
||||
do { \
|
||||
if (level <= nix::verbosity) { \
|
||||
logger->logEI(level, errorInfo); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define logError(errorInfo...) logErrorInfo(lvlError, errorInfo)
|
||||
#define logWarning(errorInfo...) logErrorInfo(lvlWarn, errorInfo)
|
||||
|
||||
/* Print a string message if the current log level is at least the specified
|
||||
level. Note that this has to be implemented as a macro to ensure that the
|
||||
arguments are evaluated lazily. */
|
||||
#define printMsg(level, args...) \
|
||||
do { \
|
||||
if (level <= nix::verbosity) { \
|
||||
|
@ -166,18 +180,7 @@ extern Verbosity verbosity; /* suppress msgs > this */
|
|||
#define debug(args...) printMsg(lvlDebug, args)
|
||||
#define vomit(args...) printMsg(lvlVomit, args)
|
||||
|
||||
#define logErrorInfo(level, errorInfo...) \
|
||||
do { \
|
||||
if (level <= nix::verbosity) { \
|
||||
logger->logEI(level, errorInfo); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define logError(errorInfo...) logErrorInfo(lvlError, errorInfo)
|
||||
#define logWarning(errorInfo...) logErrorInfo(lvlWarn, errorInfo)
|
||||
|
||||
|
||||
|
||||
/* if verbosity >= lvlWarn, print a message with a yellow 'warning:' prefix. */
|
||||
template<typename... Args>
|
||||
inline void warn(const std::string & fs, const Args & ... args)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue