1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 16:51:15 +02:00

Add warn function

This commit is contained in:
Eelco Dolstra 2017-04-12 14:53:10 +02:00
parent 31cc9366fc
commit 6d97d81656
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
2 changed files with 16 additions and 1 deletions

View file

@ -5,6 +5,11 @@ namespace nix {
Logger * logger = makeDefaultLogger();
void Logger::warn(const std::string & msg)
{
log(lvlInfo, ANSI_RED "warning:" ANSI_NORMAL " " + msg);
}
class SimpleLogger : public Logger
{
public:
@ -52,7 +57,7 @@ Verbosity verbosity = lvlInfo;
void warnOnce(bool & haveWarned, const FormatOrString & fs)
{
if (!haveWarned) {
printError(format("warning: %1%") % fs.s);
warn(fs.s);
haveWarned = true;
}
}