diff options
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/archive.cc | 2 | ||||
-rw-r--r-- | src/libutil/logging.cc | 11 | ||||
-rw-r--r-- | src/libutil/logging.hh | 15 |
3 files changed, 28 insertions, 0 deletions
diff --git a/src/libutil/archive.cc b/src/libutil/archive.cc index 51b57a8f4e97..ea1deb924e67 100644 --- a/src/libutil/archive.cc +++ b/src/libutil/archive.cc @@ -56,6 +56,8 @@ static void dumpContents(const Path & path, size_t size, static void dump(const Path & path, Sink & sink, PathFilter & filter) { + checkInterrupt(); + struct stat st; if (lstat(path.c_str(), &st)) throw SysError(format("getting attributes of path '%1%'") % path); diff --git a/src/libutil/logging.cc b/src/libutil/logging.cc index 43245f61c601..c11271e63007 100644 --- a/src/libutil/logging.cc +++ b/src/libutil/logging.cc @@ -80,4 +80,15 @@ std::atomic<uint64_t> nextId{(uint64_t) getpid() << 32}; Activity::Activity() : id(nextId++) { }; +Activity::Activity(ActivityType type, std::string msg) + : Activity() +{ + logger->event(evStartActivity, id, msg); +} + +Activity::~Activity() +{ + logger->event(evStopActivity, id); +} + } diff --git a/src/libutil/logging.hh b/src/libutil/logging.hh index 9ef6e3ee30e4..aa407f60bb65 100644 --- a/src/libutil/logging.hh +++ b/src/libutil/logging.hh @@ -13,6 +13,10 @@ typedef enum { lvlVomit } Verbosity; +typedef enum { + actCopyPath = 100, +} ActivityType; + class Activity { public: @@ -21,6 +25,10 @@ public: Activity(); Activity(const Activity & act) : id(act.id) { }; Activity(uint64_t id) : id(id) { }; + Activity(ActivityType type, std::string msg = ""); + ~Activity(); + + //void progress(...); }; typedef enum { @@ -35,6 +43,13 @@ typedef enum { evSubstitutionCreated = 8, evSubstitutionStarted = 9, evSubstitutionFinished = 10, + + evCopyStarted = 100, + evCopyProgress = 101, + + evStartActivity = 1000, + evStopActivity = 1001, + } EventType; struct Event |