diff options
author | Jan Niklas Hasse <jhasse@bixense.com> | 2020-08-03 10:48:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-03 10:48:17 (GMT) |
commit | 00968321d6ace10b6798855cab7620dc6a5620fd (patch) | |
tree | 0eb1152dc7c28de4936a4661da15580e6e6947a1 /src/build_log.h | |
parent | 086a9b2f8833fd45f2119596f74f90b9f7e2cdf5 (diff) | |
parent | cc79afbc0510b7320d35fb481f0f200dec92cb43 (diff) | |
download | Ninja-00968321d6ace10b6798855cab7620dc6a5620fd.zip Ninja-00968321d6ace10b6798855cab7620dc6a5620fd.tar.gz Ninja-00968321d6ace10b6798855cab7620dc6a5620fd.tar.bz2 |
Merge pull request #1780 from jhasse/delay-open
Delay actually opening log files until the first write, fix #1724
Diffstat (limited to 'src/build_log.h')
-rw-r--r-- | src/build_log.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/build_log.h b/src/build_log.h index ebe0530..6d060d1 100644 --- a/src/build_log.h +++ b/src/build_log.h @@ -45,7 +45,10 @@ struct BuildLog { BuildLog(); ~BuildLog(); + /// Prepares writing to the log file without actually opening it - that will + /// happen when/if it's needed bool OpenForWrite(const string& path, const BuildLogUser& user, string* err); + bool RecordCommand(Edge* edge, int start_time, int end_time, TimeStamp mtime = 0); void Close(); @@ -91,8 +94,13 @@ struct BuildLog { const Entries& entries() const { return entries_; } private: + /// Should be called before using log_file_. When false is returned, errno + /// will be set. + bool OpenForWriteIfNeeded(); + Entries entries_; FILE* log_file_; + std::string log_file_path_; bool needs_recompaction_; }; |