Add standard stream logger
Added and activated logger implementation, which will write logs to
stdout and stderr.
This way SDL logs are included to 'kubectl logs' command output
of containerized application which is using SDL library.
SDL logs starts with "shareddatalayer: " prefix.
RIC has own logging library, which will be taken into use later as
a separate commit / merge request.
Signed-off-by: Rolf Badorek <rolf.badorek@nokia.com>
Change-Id: I1b2d4085aa3112b02c4a2161e371712ea5ba2cb5
diff --git a/include/private/stdstreamlogger.hpp b/include/private/stdstreamlogger.hpp
new file mode 100755
index 0000000..4af6a8c
--- /dev/null
+++ b/include/private/stdstreamlogger.hpp
@@ -0,0 +1,62 @@
+/*
+ Copyright (c) 2018-2019 Nokia.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+#ifndef SHAREDDATALAYER_STDSTREAMLOGGER_HPP_
+#define SHAREDDATALAYER_STDSTREAMLOGGER_HPP_
+
+#include <memory>
+#include <string>
+#include "private/logger.hpp"
+
+namespace shareddatalayer
+{
+ class StdStreamLogger: public Logger
+ {
+ public:
+ explicit StdStreamLogger(const std::string& prefix);
+
+ ~StdStreamLogger();
+
+ std::ostream& emerg() override;
+
+ std::ostream& alert() override;
+
+ std::ostream& crit() override;
+
+ std::ostream& error() override;
+
+ std::ostream& warning() override;
+
+ std::ostream& notice() override;
+
+ std::ostream& info() override;
+
+ std::ostream& debug() override;
+
+ private:
+ const std::string prefix;
+ std::unique_ptr<std::ostream> osEmerg;
+ std::unique_ptr<std::ostream> osAlert;
+ std::unique_ptr<std::ostream> osCrit;
+ std::unique_ptr<std::ostream> osError;
+ std::unique_ptr<std::ostream> osWarning;
+ std::unique_ptr<std::ostream> osNotice;
+ std::unique_ptr<std::ostream> osInfo;
+ std::unique_ptr<std::ostream> osDebug;
+ };
+}
+
+#endif