blob: 05b6a1a36843c7f812905543f8fb8ce8e548beb6 [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
3#include <phosphor-logging/sdjournal.hpp>
4
Patrick Williams2544b412022-10-04 08:41:06 -05005#include <cstdarg>
6
Patrick Venture59a6b1f2018-08-29 11:41:01 -07007namespace phosphor
8{
9namespace logging
10{
11
William A. Kennington IIId8255c92021-05-19 17:08:10 -070012int SdJournalHandler::journal_send_call(const char*)
13{
14 return 0;
15}
16
17int 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 Venture59a6b1f2018-08-29 11:41:01 -070028SdJournalHandler sdjournal_impl;
29SdJournalHandler* sdjournal_ptr = &sdjournal_impl;
30
31SdJournalHandler* SwapJouralHandler(SdJournalHandler* with)
32{
33 SdJournalHandler* curr = sdjournal_ptr;
34 sdjournal_ptr = with;
35 return curr;
36}
37
38} // namespace logging
39} // namespace phosphor