Leosac  0.8.0
Open Source Access Control
init.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014-2016 Leosac
3 
4  This file is part of Leosac.
5 
6  Leosac is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Affero General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Leosac is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Affero General Public License for more details.
15 
16  You should have received a copy of the GNU Affero General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #include "MonitorModule.hpp"
21 #include "tools/log.hpp"
22 #include <boost/property_tree/ptree.hpp>
23 #include <memory>
24 #include <zmqpp/actor.hpp>
25 #include <zmqpp/context.hpp>
26 #include <zmqpp/message.hpp>
27 #include <zmqpp/poller.hpp>
28 
29 using namespace Leosac::Module::Monitor;
30 
32 {
33 
34  logger_guard(const std::initializer_list<std::string> &s)
35  : logger_names(s)
36  {
37  }
38 
40  {
41  for (const auto &l : logger_names)
42  spdlog::drop(l);
43  }
44 
45  std::vector<std::string> logger_names;
46 };
47 
48 extern "C" {
49 const char *get_module_name()
50 {
51  return "MONITOR";
52 }
53 }
54 
58 extern "C" __attribute__((visibility("default"))) bool
59 start_module(zmqpp::socket *pipe, boost::property_tree::ptree cfg,
60  zmqpp::context &zmq_ctx, Leosac::CoreUtilsPtr utils)
61 {
62  logger_guard g({"system_bus_event", "monitor_stdout"});
63  return Leosac::Module::start_module_helper<MonitorModule>(pipe, cfg, zmq_ctx,
64  utils);
65 }
zmqpp
Definition: CoreUtils.hpp:27
MonitorModule.hpp
get_module_name
const char * get_module_name()
Definition: init.cpp:26
logger_guard::logger_names
std::vector< std::string > logger_names
Definition: init.cpp:45
logger_guard
Definition: init.cpp:31
Leosac::Module::Monitor
A module that provide visual feedback to the end-user about system's activity.
Definition: MonitorModule.hpp:34
logger_guard::logger_guard
logger_guard(const std::initializer_list< std::string > &s)
Definition: init.cpp:34
logger_guard::~logger_guard
~logger_guard()
Definition: init.cpp:39
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
__attribute__
__attribute__((visibility("default"))) bool start_module(zmqpp
Entry point for the auth-db module.
Definition: init.cpp:35
log.hpp
Leosac::CoreUtilsPtr
std::shared_ptr< CoreUtils > CoreUtilsPtr
Definition: LeosacFwd.hpp:35