16
16
* Authored by: Alan Griffiths <alan@octopull.co.uk>
19
#include "mir/logging/logger.h"
20
#include "mir/logging/glog_logger.h"
19
21
#include "mir/default_server_configuration.h"
20
#include "mir/abnormal_exit.h"
22
#include "connector_report.h"
23
#include "display_report.h"
24
#include "session_mediator_report.h"
26
#include "mir/graphics/null_display_report.h"
27
#include "compositor_report.h"
30
namespace mf = mir::frontend;
31
namespace mg = mir::graphics;
22
#include "mir/options/default_configuration.h"
23
#include "mir/logging/dumb_console_logger.h"
32
25
namespace ml = mir::logging;
33
namespace ms = mir::scene;
35
auto mir::DefaultServerConfiguration::the_connector_report()
36
-> std::shared_ptr<mf::ConnectorReport>
38
return connector_report([this]
39
() -> std::shared_ptr<mf::ConnectorReport>
41
auto opt = the_options()->get<std::string>(connector_report_opt);
43
if (opt == log_opt_value)
45
return std::make_shared<ml::ConnectorReport>(the_logger());
47
else if (opt == off_opt_value)
49
return std::make_shared<mf::NullConnectorReport>();
53
throw AbnormalExit(std::string("Invalid ") + connector_report_opt + " option: " + opt +
54
" (valid options are: \"" + off_opt_value + "\" and \"" + log_opt_value + "\")");
59
std::shared_ptr<mg::DisplayReport> mir::DefaultServerConfiguration::the_display_report()
61
return display_report(
62
[this]() -> std::shared_ptr<graphics::DisplayReport>
64
if (the_options()->get<std::string>(display_report_opt) == log_opt_value)
66
return std::make_shared<ml::DisplayReport>(the_logger());
70
return std::make_shared<mg::NullDisplayReport>();
75
std::shared_ptr<compositor::CompositorReport>
76
DefaultServerConfiguration::the_compositor_report()
78
return compositor_report(
79
[this]() -> std::shared_ptr<compositor::CompositorReport>
81
if (the_options()->get<std::string>(compositor_report_opt) == log_opt_value)
83
return std::make_shared<ml::CompositorReport>(
84
the_logger(), the_clock());
88
return std::make_shared<compositor::NullCompositorReport>();
93
std::shared_ptr<mf::SessionMediatorReport>
94
mir::DefaultServerConfiguration::the_session_mediator_report()
96
return session_mediator_report(
97
[this]() -> std::shared_ptr<mf::SessionMediatorReport>
99
if (the_options()->get<std::string>(session_mediator_report_opt) == log_opt_value)
101
return std::make_shared<ml::SessionMediatorReport>(the_logger());
105
return std::make_shared<mf::NullSessionMediatorReport>();
27
auto mir::DefaultServerConfiguration::the_logger()
28
-> std::shared_ptr<ml::Logger>
31
[this]() -> std::shared_ptr<ml::Logger>
33
if (the_options()->is_set(options::glog))
35
return std::make_shared<ml::GlogLogger>(
37
the_options()->get<int>(options::glog_stderrthreshold),
38
the_options()->get<int>(options::glog_minloglevel),
39
the_options()->get<std::string>(options::glog_log_dir));
43
return std::make_shared<ml::DumbConsoleLogger>();