aboutsummaryrefslogtreecommitdiffstats
path: root/src/VppLogHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/VppLogHandler.cpp')
-rw-r--r--src/VppLogHandler.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/VppLogHandler.cpp b/src/VppLogHandler.cpp
new file mode 100644
index 0000000..3fdd214
--- /dev/null
+++ b/src/VppLogHandler.cpp
@@ -0,0 +1,44 @@
+/* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */
+/*
+ * Implementation for VppLogHandler class.
+ *
+ * Copyright (c) 2017 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+#include <iostream>
+
+#include <opflexagent/logging.h>
+
+#include "VppLogHandler.hpp"
+
+namespace VPP
+{
+
+void
+LogHandler::handle_message(const std::string &file,
+ const int line,
+ const std::string &function,
+ const VOM::log_level_t &level,
+ const std::string &message)
+{
+ opflexagent::LogLevel agentLevel = opflexagent::INFO;
+
+ if (VOM::log_level_t::DEBUG == level)
+ agentLevel = opflexagent::DEBUG;
+ else if (VOM::log_level_t::INFO == level)
+ agentLevel = opflexagent::INFO;
+ else if (VOM::log_level_t::WARNING == level)
+ agentLevel = opflexagent::WARNING;
+ else if (VOM::log_level_t::ERROR == level)
+ agentLevel = opflexagent::ERROR;
+ else if (VOM::log_level_t::CRITICAL == level)
+ agentLevel = opflexagent::FATAL;
+
+ LOG1(agentLevel, file.c_str(), line, function.c_str(), message);
+}
+
+} /* namespace opflexagent */