William A. Kennington III | d8255c9 | 2021-05-19 17:08:10 -0700 | [diff] [blame] | 1 | #include <systemd/sd-journal.h> |
Patrick Venture | 59a6b1f | 2018-08-29 11:41:01 -0700 | [diff] [blame] | 2 | |
| 3 | #include <phosphor-logging/sdjournal.hpp> |
| 4 | |
Patrick Williams | 2544b41 | 2022-10-04 08:41:06 -0500 | [diff] [blame] | 5 | #include <cstdarg> |
| 6 | |
Patrick Venture | 59a6b1f | 2018-08-29 11:41:01 -0700 | [diff] [blame] | 7 | namespace phosphor |
| 8 | { |
| 9 | namespace logging |
| 10 | { |
| 11 | |
William A. Kennington III | d8255c9 | 2021-05-19 17:08:10 -0700 | [diff] [blame] | 12 | int SdJournalHandler::journal_send_call(const char*) |
| 13 | { |
| 14 | return 0; |
| 15 | } |
| 16 | |
| 17 | int SdJournalHandler::journal_send(const char* fmt, ...) |
| 18 | { |
| 19 | va_list args; |
| 20 | va_start(args, fmt); |
| 21 | |
| 22 | int rc = ::sd_journal_send(fmt, args, NULL); |
| 23 | va_end(args); |
| 24 | |
| 25 | return rc; |
| 26 | } |
| 27 | |
Patrick Venture | 59a6b1f | 2018-08-29 11:41:01 -0700 | [diff] [blame] | 28 | SdJournalHandler sdjournal_impl; |
| 29 | SdJournalHandler* sdjournal_ptr = &sdjournal_impl; |
| 30 | |
| 31 | SdJournalHandler* SwapJouralHandler(SdJournalHandler* with) |
| 32 | { |
| 33 | SdJournalHandler* curr = sdjournal_ptr; |
| 34 | sdjournal_ptr = with; |
| 35 | return curr; |
| 36 | } |
| 37 | |
| 38 | } // namespace logging |
| 39 | } // namespace phosphor |