diff options
author | Arne Juul <arnej@yahooinc.com> | 2023-01-12 14:39:50 +0000 |
---|---|---|
committer | Arne Juul <arnej@yahooinc.com> | 2023-01-12 14:41:17 +0000 |
commit | b341da3140312bce5a36e4365cbbe0dd656f2868 (patch) | |
tree | 85010a35a33339f3f8a15aa6500f595c3e09a9e4 /vespalog | |
parent | 3c882ba848321d5d22643a5dd13fc37c6c3128b4 (diff) |
add accessor for current log target
Diffstat (limited to 'vespalog')
-rw-r--r-- | vespalog/src/vespa/log/log.cpp | 9 | ||||
-rw-r--r-- | vespalog/src/vespa/log/log.h | 3 |
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(); }; |