diff options
-rw-r--r-- | src/libexpr/nixexpr.cc | 6 | ||||
-rw-r--r-- | src/libmain/progress-bar.cc | 1 | ||||
-rw-r--r-- | src/libmain/shared.cc | 1 | ||||
-rw-r--r-- | src/libstore/daemon.cc | 3 | ||||
-rw-r--r-- | src/libutil/error.cc | 3 | ||||
-rw-r--r-- | src/libutil/error.hh | 3 | ||||
-rw-r--r-- | src/libutil/logging.cc | 4 | ||||
-rw-r--r-- | src/libutil/logging.hh | 3 | ||||
-rw-r--r-- | src/libutil/util.cc | 2 |
9 files changed, 7 insertions, 19 deletions
diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc index 2b22ef3b6..d5698011f 100644 --- a/src/libexpr/nixexpr.cc +++ b/src/libexpr/nixexpr.cc @@ -197,11 +197,11 @@ std::ostream & operator << (std::ostream & str, const Pos & pos) if (!pos) str << "undefined position"; else - { + { auto f = format(ANSI_BOLD "%1%" ANSI_NORMAL ":%2%:%3%"); - switch (pos.origin) { + switch (pos.origin) { case foFile: - f % (string) pos.file; + f % (string) pos.file; break; case foStdin: case foString: diff --git a/src/libmain/progress-bar.cc b/src/libmain/progress-bar.cc index 8da0f942e..265b16908 100644 --- a/src/libmain/progress-bar.cc +++ b/src/libmain/progress-bar.cc @@ -134,7 +134,6 @@ public: std::stringstream oss; showErrorInfo(oss, ei, showTrace); - // oss << ei; log(*state, ei.level, oss.str()); } diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index 722e384fc..5cbdd19e5 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -325,7 +325,6 @@ int handleExceptions(const string & programName, std::function<void()> fun) } catch (BaseError & e) { logger->setShowTrace(settings.showTrace); logError(e.info()); - // TODO fix to detect non-empty trace here. if (e.hasTrace() && !settings.showTrace) printError("(use '--show-trace' to show detailed location information)"); return e.status; diff --git a/src/libstore/daemon.cc b/src/libstore/daemon.cc index 6f42093d5..186ccc5b4 100644 --- a/src/libstore/daemon.cc +++ b/src/libstore/daemon.cc @@ -80,10 +80,9 @@ struct TunnelLogger : public Logger std::stringstream oss; showErrorInfo(oss, ei, false); - // oss << ei; StringSink buf; - buf << STDERR_NEXT << oss.str() << "\n"; // (fs.s + "\n"); + buf << STDERR_NEXT << oss.str() << "\n"; enqueueMsg(*buf.s); } diff --git a/src/libutil/error.cc b/src/libutil/error.cc index 229c1e6ed..7d105d8b4 100644 --- a/src/libutil/error.cc +++ b/src/libutil/error.cc @@ -27,7 +27,6 @@ const string& BaseError::calcWhat() const std::ostringstream oss; showErrorInfo(oss, err, false); - // oss << err; what_ = oss.str(); return *what_; @@ -35,7 +34,6 @@ const string& BaseError::calcWhat() const } std::optional<string> ErrorInfo::programName = std::nullopt; -// bool ErrorInfo::showTrace = false; std::ostream& operator<<(std::ostream &os, const hintformat &hf) { @@ -212,7 +210,6 @@ void printAtPos(const string &prefix, const ErrPos &pos, std::ostream &out) } } -// std::ostream& operator<<(std::ostream &out, const ErrorInfo &einfo) std::ostream& showErrorInfo(std::ostream &out, const ErrorInfo &einfo, bool showTrace) { auto errwidth = std::max<size_t>(getWindowSize().second, 20); diff --git a/src/libutil/error.hh b/src/libutil/error.hh index 4e86666fe..1b0fb43b8 100644 --- a/src/libutil/error.hh +++ b/src/libutil/error.hh @@ -111,10 +111,8 @@ struct ErrorInfo { std::list<Trace> traces; static std::optional<string> programName; - // static bool showTrace; }; -// std::ostream& operator<<(std::ostream &out, const ErrorInfo &einfo); std::ostream& showErrorInfo(std::ostream &out, const ErrorInfo &einfo, bool showTrace); /* BaseError should generally not be caught, as it has Interrupted as @@ -122,7 +120,6 @@ std::ostream& showErrorInfo(std::ostream &out, const ErrorInfo &einfo, bool show class BaseError : public std::exception { protected: - // string prefix_; // used for location traces etc. mutable ErrorInfo err; mutable std::optional<string> what_; diff --git a/src/libutil/logging.cc b/src/libutil/logging.cc index 4de4c4012..504f5fb52 100644 --- a/src/libutil/logging.cc +++ b/src/libutil/logging.cc @@ -81,7 +81,6 @@ public: { std::stringstream oss; showErrorInfo(oss, ei, showTrace); - // oss << ei; log(ei.level, oss.str()); } @@ -158,7 +157,7 @@ struct JSONLogger : Logger { void setShowTrace(bool showTrace) override { prevLogger.setShowTrace(showTrace); } - + void addFields(nlohmann::json & json, const Fields & fields) { if (fields.empty()) return; @@ -190,7 +189,6 @@ struct JSONLogger : Logger { { std::ostringstream oss; showErrorInfo(oss, ei, getShowTrace()); - // oss << ei; nlohmann::json json; json["action"] = "msg"; diff --git a/src/libutil/logging.hh b/src/libutil/logging.hh index 3c164c670..273300b50 100644 --- a/src/libutil/logging.hh +++ b/src/libutil/logging.hh @@ -149,8 +149,7 @@ struct PushActivity extern Logger * logger; -Logger * makeSimpleLogger(bool printBuildLogs, bool showTrace); -// Logger * makeSimpleLogger(bool printBuildLogs = true, bool showTrace); +Logger * makeSimpleLogger(bool printBuildLogs = true, bool showTrace = false); Logger * makeJSONLogger(Logger & prevLogger); diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 92035c3ad..1268b146a 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -972,7 +972,7 @@ pid_t startProcess(std::function<void()> fun, const ProcessOptions & options) { auto wrapper = [&]() { if (!options.allowVfork) - logger = makeSimpleLogger(true, false); // TODO remove args. + logger = makeSimpleLogger(); try { #if __linux__ if (options.dieWithParent && prctl(PR_SET_PDEATHSIG, SIGKILL) == -1) |