1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 05:21:16 +02:00

showTrace flag in loggers

This commit is contained in:
Ben Burdette 2020-06-29 10:20:51 -06:00
parent ef24a0835d
commit 8f81fae116
10 changed files with 60 additions and 20 deletions

View file

@ -41,9 +41,10 @@ struct TunnelLogger : public Logger
Sync<State> state_;
unsigned int clientVersion;
bool showTrace;
TunnelLogger(FdSink & to, unsigned int clientVersion)
: to(to), clientVersion(clientVersion) { }
: to(to), clientVersion(clientVersion), showTrace(false) { }
void enqueueMsg(const std::string & s)
{
@ -78,13 +79,21 @@ struct TunnelLogger : public Logger
if (ei.level > verbosity) return;
std::stringstream oss;
oss << ei;
showErrorInfo(oss, ei, false);
// oss << ei;
StringSink buf;
buf << STDERR_NEXT << oss.str() << "\n"; // (fs.s + "\n");
enqueueMsg(*buf.s);
}
bool getShowTrace() const override {
return showTrace;
}
void setShowTrace(bool showTrace) override {
this->showTrace = showTrace;
}
/* startWork() means that we're starting an operation for which we
want to send out stderr to the client. */
void startWork()