diff options
author | Patrick Venture <venture@google.com> | 2018-08-29 11:41:01 -0700 |
---|---|---|
committer | Patrick Venture <venture@google.com> | 2018-11-11 08:21:26 -0800 |
commit | 59a6b1f27e83066baa6f3711c88d6a3b9a5c4d49 (patch) | |
tree | 56c0b0abc5dd83b3d83ab598f47df663b8561e80 /sdjournal.cpp | |
parent | 30047bf9647215951ba5dfe21ceb3e58a1b405a4 (diff) | |
download | phosphor-logging-59a6b1f27e83066baa6f3711c88d6a3b9a5c4d49.tar.gz phosphor-logging-59a6b1f27e83066baa6f3711c88d6a3b9a5c4d49.zip |
add sdjournal interface to inject tests
The goal of the tests is not to test phosphor-logging, but rather allow
code to call through phosphor-logging/log<> during a test.
Change-Id: Id8c84ded473decc7f9f0be268116083093f86e54
Signed-off-by: Patrick Venture <venture@google.com>
Diffstat (limited to 'sdjournal.cpp')
-rw-r--r-- | sdjournal.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sdjournal.cpp b/sdjournal.cpp new file mode 100644 index 0000000..77ced46 --- /dev/null +++ b/sdjournal.cpp @@ -0,0 +1,21 @@ +#include "config.h" + +#include <phosphor-logging/sdjournal.hpp> + +namespace phosphor +{ +namespace logging +{ + +SdJournalHandler sdjournal_impl; +SdJournalHandler* sdjournal_ptr = &sdjournal_impl; + +SdJournalHandler* SwapJouralHandler(SdJournalHandler* with) +{ + SdJournalHandler* curr = sdjournal_ptr; + sdjournal_ptr = with; + return curr; +} + +} // namespace logging +} // namespace phosphor |