aboutsummaryrefslogtreecommitdiffstats
path: root/vespalog
diff options
context:
space:
mode:
Diffstat (limited to 'vespalog')
-rw-r--r--vespalog/src/vespa/log/log.cpp9
-rw-r--r--vespalog/src/vespa/log/log.h3
2 files changed, 12 insertions, 0 deletions
diff --git a/vespalog/src/vespa/log/log.cpp b/vespalog/src/vespa/log/log.cpp
index 9a65c39c17d..69d69b97874 100644
--- a/vespalog/src/vespa/log/log.cpp
+++ b/vespalog/src/vespa/log/log.cpp
@@ -406,4 +406,13 @@ Logger::doEventState(const char *name, const char *value)
doLog(event, "", 0, "state/1 name=\"%s\" value=\"%s\"", name, value);
}
+LogTarget *
+Logger::getCurrentTarget()
+{
+ if (_target == nullptr) {
+ throwInvalid("No current log target");
+ }
+ return _target;
+}
+
} // end namespace ns_log
diff --git a/vespalog/src/vespa/log/log.h b/vespalog/src/vespa/log/log.h
index 8598bfda6d6..0ed11129c9b 100644
--- a/vespalog/src/vespa/log/log.h
+++ b/vespalog/src/vespa/log/log.h
@@ -237,6 +237,9 @@ public:
// Only for unit testing
void setTimer(std::unique_ptr<Timer> timer) { _timer = std::move(timer); }
+
+ // Only for internal use
+ static LogTarget *getCurrentTarget();
};