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