about summary refs log tree commit diff
path: root/src/libutil/logging.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-08-25T15·49+0200
committerEelco Dolstra <edolstra@gmail.com>2017-08-25T15·49+0200
commitc137c0a5ebc0d58c53f86986ab66967ac8629cbe (patch)
tree38e01bef5549985449a4c911c1444758d585335f /src/libutil/logging.cc
parentf194629f96d4bdbded897e7e88ac0d03211c959d (diff)
Allow activities to be nested
In particular, this allows more relevant activities ("substituting X")
to supersede inferior ones ("downloading X").
Diffstat (limited to 'src/libutil/logging.cc')
-rw-r--r--src/libutil/logging.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libutil/logging.cc b/src/libutil/logging.cc
index 87f20664ef08..b103b902eab0 100644
--- a/src/libutil/logging.cc
+++ b/src/libutil/logging.cc
@@ -5,6 +5,8 @@
 
 namespace nix {
 
+thread_local ActivityId curActivity = 0;
+
 Logger * logger = makeDefaultLogger();
 
 void Logger::warn(const std::string & msg)
@@ -75,10 +77,10 @@ Logger * makeDefaultLogger()
 std::atomic<uint64_t> nextId{(uint64_t) getpid() << 32};
 
 Activity::Activity(Logger & logger, ActivityType type,
-    const std::string & s, const Logger::Fields & fields)
+    const std::string & s, const Logger::Fields & fields, ActivityId parent)
     : logger(logger), id(nextId++)
 {
-    logger.startActivity(id, type, s, fields);
+    logger.startActivity(id, type, s, fields, parent);
 }
 
 }