blob: 76c28e96d64e1994020147a082bb74e62c1fda8f [file] [log] [blame]
William A. Kennington IIId8255c92021-05-19 17:08:10 -07001#include <systemd/sd-journal.h>
Patrick Venture59a6b1f2018-08-29 11:41:01 -07002
William A. Kennington IIId8255c92021-05-19 17:08:10 -07003#include <cstdarg>
Patrick Venture59a6b1f2018-08-29 11:41:01 -07004#include <phosphor-logging/sdjournal.hpp>
5
6namespace phosphor
7{
8namespace logging
9{
10
William A. Kennington IIId8255c92021-05-19 17:08:10 -070011int SdJournalHandler::journal_send_call(const char*)
12{
13 return 0;
14}
15
16int 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 Venture59a6b1f2018-08-29 11:41:01 -070027SdJournalHandler sdjournal_impl;
28SdJournalHandler* sdjournal_ptr = &sdjournal_impl;
29
30SdJournalHandler* SwapJouralHandler(SdJournalHandler* with)
31{
32 SdJournalHandler* curr = sdjournal_ptr;
33 sdjournal_ptr = with;
34 return curr;
35}
36
37} // namespace logging
38} // namespace phosphor