1 #include <systemd/sd-journal.h> 2 3 #include <cstdarg> 4 #include <phosphor-logging/sdjournal.hpp> 5 6 namespace phosphor 7 { 8 namespace logging 9 { 10 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 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 39