blob: 3fdd2146375c31d2ed7c090f66555beb8d2bf136 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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 */
|