Module: check_mk
Branch: master
Commit: 2b898490c5f1f6138029420c218240babbb03011
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2b898490c5f1f6…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue Aug 30 09:47:01 2016 +0200
Fetched Livestatus from downstream.
---
livestatus/src/Logger.h | 18 +++++++++++++++++-
livestatus/src/logger.cc | 6 ++++--
livestatus/src/logger.h | 36 ------------------------------------
livestatus/src/module.cc | 1 -
4 files changed, 21 insertions(+), 40 deletions(-)
diff --git a/livestatus/src/Logger.h b/livestatus/src/Logger.h
index 890c6de..8fd7479 100644
--- a/livestatus/src/Logger.h
+++ b/livestatus/src/Logger.h
@@ -26,13 +26,29 @@
#define Logger_h
#include "config.h" // IWYU pragma: keep
+#include <syslog.h>
+#include <cstdio>
#include <sstream>
-#include "logger.h"
+#include <string>
+
+void open_logfile(const std::string &path);
+void close_logfile();
+void logger(int priority, const std::string &message);
+
+#ifdef CMC
+void set_log_config(int log_level, bool log_microtime);
+void reopen_logfile(const std::string &path);
+bool should_log(int priority);
+FILE *get_logfile();
+#endif
class Logger {
public:
explicit Logger(int priority) : _priority(priority) {}
virtual ~Logger() { logger(_priority, _os.str()); }
+#ifdef CMC
+ bool isEnabled() const { return should_log(_priority); }
+#endif
template <typename T>
std::ostream &operator<<(const T &t) {
diff --git a/livestatus/src/logger.cc b/livestatus/src/logger.cc
index cdd8882..9302840 100644
--- a/livestatus/src/logger.cc
+++ b/livestatus/src/logger.cc
@@ -25,12 +25,14 @@
// Needed for localtime_r
#define _XOPEN_SOURCE 500
-#include "logger.h"
#include <pthread.h>
-#include <cerrno>
#include <cstdio>
+#include <syslog.h>
+#include <cerrno>
#include <cstring>
#include <ctime>
+#include <string>
+#include "Logger.h" // IWYU pragma: keep
#include "nagios.h"
using std::string;
diff --git a/livestatus/src/logger.h b/livestatus/src/logger.h
deleted file mode 100644
index d297c3c..0000000
--- a/livestatus/src/logger.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// +------------------------------------------------------------------+
-// | ____ _ _ __ __ _ __ |
-// | / ___| |__ ___ ___| | __ | \/ | |/ / |
-// | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
-// | | |___| | | | __/ (__| < | | | | . \ |
-// | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
-// | |
-// | Copyright Mathias Kettner 2014 mk(a)mathias-kettner.de |
-// +------------------------------------------------------------------+
-//
-// This file is part of Check_MK.
-// The official homepage is at
http://mathias-kettner.de/check_mk.
-//
-// check_mk is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by
-// the Free Software Foundation in version 2. check_mk is distributed
-// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
-// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-// PARTICULAR PURPOSE. See the GNU General Public License for more de-
-// tails. You should have received a copy of the GNU General Public
-// License along with GNU Make; see the file COPYING. If not, write
-// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
-// Boston, MA 02110-1301 USA.
-
-#ifndef logger_h
-#define logger_h
-
-#include "config.h" // IWYU pragma: keep
-#include <syslog.h> // IWYU pragma: keep
-#include <string>
-
-void logger(int priority, const std::string &message);
-void open_logfile(const std::string &path);
-void close_logfile();
-
-#endif // logger_h
diff --git a/livestatus/src/module.cc b/livestatus/src/module.cc
index 6b8b761..1e5f692 100644
--- a/livestatus/src/module.cc
+++ b/livestatus/src/module.cc
@@ -57,7 +57,6 @@
#include "data_encoding.h"
#include "global_counters.h"
#include "livestatus.h"
-#include "logger.h"
#include "nagios.h"
#include "strutil.h"
#include "waittriggers.h"