2
* Copyright © 2013 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 3,
6
* as published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: Alan Griffiths <alan@octopull.co.uk>
19
#include "mir/logging/connector_report.h"
21
#include "mir/logging/logger.h"
23
#include <boost/exception/diagnostic_information.hpp>
28
namespace ml = mir::logging;
32
char const* const component = "frontend::SessionMediator";
35
ml::ConnectorReport::ConnectorReport(std::shared_ptr<Logger> const& log) :
40
void ml::ConnectorReport::thread_start()
43
ss << "thread (" << std::this_thread::get_id() << ") started.";
44
logger->log<Logger::informational>(ss.str(), component);
47
void ml::ConnectorReport::thread_end()
50
ss << "thread (" << std::this_thread::get_id() << ") ended.";
51
logger->log<Logger::informational>(ss.str(), component);
54
void ml::ConnectorReport::starting_threads(int count)
57
ss << "Starting " << count << ") ended.";
58
logger->log<Logger::informational>(ss.str(), component);
61
void ml::ConnectorReport::stopping_threads(int count)
64
ss << "Stopping " << count << " threads.";
65
logger->log<Logger::informational>(ss.str(), component);
68
void ml::ConnectorReport::creating_session_for(int socket_handle)
71
ss << "Creating session for socket " << socket_handle;
72
logger->log<Logger::informational>(ss.str(), component);
75
void ml::ConnectorReport::creating_socket_pair(int server_handle, int client_handle)
78
ss << "Creating socket pair (server=" << server_handle << ", client=" << client_handle << ").";
79
logger->log<Logger::informational>(ss.str(), component);
82
void ml::ConnectorReport::listening_on(std::string const& endpoint)
85
ss << "Listening on endpoint: " << endpoint;
86
logger->log<Logger::informational>(ss.str(), component);
89
void ml::ConnectorReport::error(std::exception const& error)
92
ss << "Error: " << boost::diagnostic_information(error) << std::endl;
94
logger->log<ml::Logger::warning>(ss.str(), component);