ealogger
ealogger is a c++ library that provides a blazing fast and easy to use logging mechanism
sink_syslog.h
Go to the documentation of this file.
1 // ealogger is a simple, asynchronous and powerful logger library for c++
2 // Copyright 2013 - 2016 Christian Rapp
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SINK_SYSLOG_H
17 #define SINK_SYSLOG_H
18 
23 #ifdef EALOGGER_SYSLOG
24 #include <syslog.h>
25 #endif
26 
27 #include <ealogger/sink.h>
28 
29 namespace ealogger
30 {
38 class SinkSyslog : public Sink
39 {
40 public:
55  SinkSyslog(std::string msg_template, std::string datetime_pattern,
57  virtual ~SinkSyslog();
58 
59 private:
60  std::map<ealogger::constants::LOG_LEVEL, int>
61  loglevel_syslog_lookup;
63  std::mutex mtx_syslog;
64 
65  void write_message(ATTR_UNUSED const std::string &msg);
66  void config_changed();
67 };
71 }
72 
73 #endif /* SINK_SYSLOG_H */
std::string datetime_pattern
Definition: sink.h:141
Main namespace for ealogger.
Definition: conversion_pattern.h:28
A sink is an object that writes the log message to a specific target.
Definition: sink.h:52
bool enabled
Definition: sink.h:142
std::string msg_template
Definition: sink.h:140
SinkSyslog(std::string msg_template, std::string datetime_pattern, bool enabled, ealogger::constants::LOG_LEVEL min_lvl)
Constructor for a syslog sink.
Definition: sink_syslog.cpp:21
Sink writing to unix syslog.
Definition: sink_syslog.h:38
LOG_LEVEL
An enumaration representing the supported loglevels.
Definition: global.h:58