xref: /openbmc/phosphor-logging/lib/sdjournal.cpp (revision 2544b4191d2a33d955317717e08040ac93d6ad1a)
1e0538848SWilliam A. Kennington III #include <systemd/sd-journal.h>
2e0538848SWilliam A. Kennington III 
3e0538848SWilliam A. Kennington III #include <phosphor-logging/sdjournal.hpp>
4e0538848SWilliam A. Kennington III 
5*2544b419SPatrick Williams #include <cstdarg>
6*2544b419SPatrick Williams 
7e0538848SWilliam A. Kennington III namespace phosphor
8e0538848SWilliam A. Kennington III {
9e0538848SWilliam A. Kennington III namespace logging
10e0538848SWilliam A. Kennington III {
11e0538848SWilliam A. Kennington III 
journal_send_call(const char *)12e0538848SWilliam A. Kennington III int SdJournalHandler::journal_send_call(const char*)
13e0538848SWilliam A. Kennington III {
14e0538848SWilliam A. Kennington III     return 0;
15e0538848SWilliam A. Kennington III }
16e0538848SWilliam A. Kennington III 
journal_send(const char * fmt,...)17e0538848SWilliam A. Kennington III int SdJournalHandler::journal_send(const char* fmt, ...)
18e0538848SWilliam A. Kennington III {
19e0538848SWilliam A. Kennington III     va_list args;
20e0538848SWilliam A. Kennington III     va_start(args, fmt);
21e0538848SWilliam A. Kennington III 
22e0538848SWilliam A. Kennington III     int rc = ::sd_journal_send(fmt, args, NULL);
23e0538848SWilliam A. Kennington III     va_end(args);
24e0538848SWilliam A. Kennington III 
25e0538848SWilliam A. Kennington III     return rc;
26e0538848SWilliam A. Kennington III }
27e0538848SWilliam A. Kennington III 
28e0538848SWilliam A. Kennington III SdJournalHandler sdjournal_impl;
29e0538848SWilliam A. Kennington III SdJournalHandler* sdjournal_ptr = &sdjournal_impl;
30e0538848SWilliam A. Kennington III 
SwapJouralHandler(SdJournalHandler * with)31e0538848SWilliam A. Kennington III SdJournalHandler* SwapJouralHandler(SdJournalHandler* with)
32e0538848SWilliam A. Kennington III {
33e0538848SWilliam A. Kennington III     SdJournalHandler* curr = sdjournal_ptr;
34e0538848SWilliam A. Kennington III     sdjournal_ptr = with;
35e0538848SWilliam A. Kennington III     return curr;
36e0538848SWilliam A. Kennington III }
37e0538848SWilliam A. Kennington III 
38e0538848SWilliam A. Kennington III } // namespace logging
39e0538848SWilliam A. Kennington III } // namespace phosphor
40