Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sinks: Make syslog_sink.h's syslog_prio_from_level protected #2918

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions include/spdlog/sinks/syslog_sink.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ class syslog_sink : public base_sink<Mutex> {
void flush_() override {}
bool enable_formatting_ = false;

private:
using levels_array = std::array<int, 7>;
levels_array syslog_levels_;
// must store the ident because the man says openlog might use the pointer as
// is and not a string copy
const std::string ident_;

//
// Simply maps spdlog's log level to syslog priority level.
//
int syslog_prio_from_level(const details::log_msg &msg) const {
return syslog_levels_.at(static_cast<levels_array::size_type>(msg.level));
}

private:
using levels_array = std::array<int, 7>;
levels_array syslog_levels_;
// must store the ident because the man says openlog might use the pointer as
// is and not a string copy
const std::string ident_;
};

using syslog_sink_mt = syslog_sink<std::mutex>;
Expand Down