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

comments and cleanup

This commit is contained in:
Ben Burdette 2020-06-30 16:31:55 -06:00
parent 70bcb39d3f
commit 9159dfe3d8
9 changed files with 7 additions and 19 deletions

View file

@ -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);

View file

@ -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_;

View file

@ -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";

View file

@ -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);

View file

@ -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)