Line buffering and log tracking for build output.
More...
#include <build-log.hh>
Line buffering and log tracking for build output.
This class handles:
- Owning the build Activity for logging
- Buffering partial lines (handling \r and \n)
- Maintaining a tail of recent log lines (for error messages)
- Processing JSON log messages via handleJSONLogMessage
Implements Sink so it can be used as a data destination. I/O is handled separately by the caller.
◆ BuildLog()
| nix::BuildLog::BuildLog |
( |
size_t | maxTailLines, |
|
|
std::unique_ptr< Activity > | act ) |
- Parameters
-
| maxTailLines | Maximum number of tail lines to keep |
| act | Activity for this build |
◆ flush()
| void nix::BuildLog::flush |
( |
| ) |
|
Flush any remaining partial line. Call this when the child process exits.
◆ getTail()
| const std::list< std::string > & nix::BuildLog::getTail |
( |
| ) |
const |
|
inline |
Get the most recent log lines. Used for including in error messages.
◆ hasPartialLine()
| bool nix::BuildLog::hasPartialLine |
( |
| ) |
const |
|
inline |
Check if there's an incomplete line buffered.
◆ operator()()
| void nix::BuildLog::operator() |
( |
std::string_view | data | ) |
|
|
overridevirtual |
Process output data from child process. Handles JSON log messages and emits regular lines to activity.
- Parameters
-
| data | Raw output data from child |
Implements nix::Sink.
◆ act
| std::unique_ptr<Activity> nix::BuildLog::act |
◆ builderActivities
| std::map<ActivityId, Activity> nix::BuildLog::builderActivities |
Map for tracking nested activities from JSON messages.
The documentation for this struct was generated from the following files:
- libstore/include/nix/store/build/build-log.hh
- libstore/build/build-log.cc