libutil: add buffer state management to loggers
currently all loggers can always accept messages and never suggest flushing buffers. in the future this may change, and at that point we're already fully set up for it. local loggers should never keep asynchronous (i.e. network-backed) buffers, disk buffers are fine. networked loggers will require buffers and periodic flushes later. Change-Id: Ide2114f5bc17f4a1d289c92ed4f9381a1d59dacf
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "lix/libexpr/eval-settings.hh"
|
||||
|
||||
#include "lix/libutil/logging.hh"
|
||||
#include "tests/libexpr.hh"
|
||||
|
||||
namespace nix {
|
||||
@@ -17,12 +18,16 @@ namespace nix {
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
void log(Verbosity lvl, std::string_view s) override {
|
||||
BufferState log(Verbosity lvl, std::string_view s) override
|
||||
{
|
||||
oss << s << std::endl;
|
||||
return BufferState::HasSpace;
|
||||
}
|
||||
|
||||
void logEI(const ErrorInfo & ei) override {
|
||||
BufferState logEI(const ErrorInfo & ei) override
|
||||
{
|
||||
showErrorInfo(oss, ei, loggerSettings.showTrace.get());
|
||||
return BufferState::HasSpace;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user