Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
build-log.hh
Go to the documentation of this file.
1#pragma once
3
4#include "nix/util/logging.hh"
6
7#include <list>
8#include <map>
9#include <string>
10
11namespace nix {
12
25struct BuildLog : Sink
26{
27private:
28 size_t maxTailLines;
29
30 std::list<std::string> logTail;
31 std::string currentLogLine;
32 size_t currentLogLinePos = 0; // to handle carriage return
33
34 bool pendingCR = false; // defer '\r' so "\r\n" is treated as a line terminator
35
36 void flushLine();
37
38public:
42 std::unique_ptr<Activity> act;
43
47 std::map<ActivityId, Activity> builderActivities;
48
53 BuildLog(size_t maxTailLines, std::unique_ptr<Activity> act);
54
60 void operator()(std::string_view data) override;
61
66 void flush();
67
72 const std::list<std::string> & getTail() const
73 {
74 return logTail;
75 }
76
80 bool hasPartialLine() const
81 {
82 return !currentLogLine.empty();
83 }
84};
85
86} // namespace nix
const std::list< std::string > & getTail() const
Definition build-log.hh:72
void operator()(std::string_view data) override
Definition build-log.cc:11
bool hasPartialLine() const
Definition build-log.hh:80
std::unique_ptr< Activity > act
Definition build-log.hh:42
void flush()
Definition build-log.cc:33
std::map< ActivityId, Activity > builderActivities
Definition build-log.hh:47
BuildLog(size_t maxTailLines, std::unique_ptr< Activity > act)
Definition build-log.cc:5
Definition serialise.hh:18