-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHttpLoggingServiceInstance.cc
More file actions
37 lines (32 loc) · 1.39 KB
/
HttpLoggingServiceInstance.cc
File metadata and controls
37 lines (32 loc) · 1.39 KB
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
/*
* Copyright (C) 2021 Frank Mertens.
*
* Distribution and use is allowed under the terms of the GNU General Public License version 3
* (see CoreComponents/LICENSE-gpl-3.0).
*
*/
#include <cc/HttpLoggingServiceInstance>
#include <cc/HttpStatusLogStream>
#include <cc/HttpLoggingServiceRegistry>
#include <cc/NullStream>
namespace cc {
HttpLoggingServiceInstance::State::State(const MetaObject &config):
verbosity_{readLoggingLevel(config("verbosity").to<String>())},
errorStream_{NullStream{}},
warningStream_{NullStream{}},
noticeStream_{NullStream{}},
infoStream_{NullStream{}},
debugStream_{NullStream{}}
{
if (verbosity_ >= LoggingLevel::Error ) errorStream_ = HttpStatusLogStream{*this, LoggingLevel::Error};
if (verbosity_ >= LoggingLevel::Warning) warningStream_ = HttpStatusLogStream{*this, LoggingLevel::Warning};
if (verbosity_ >= LoggingLevel::Notice ) noticeStream_ = HttpStatusLogStream{*this, LoggingLevel::Notice};
if (verbosity_ >= LoggingLevel::Info ) infoStream_ = HttpStatusLogStream{*this, LoggingLevel::Info};
if (verbosity_ >= LoggingLevel::Debug ) debugStream_ = HttpStatusLogStream{*this, LoggingLevel::Debug};
}
HttpLoggingServiceInstance::HttpLoggingServiceInstance(const MetaObject &config)
{
auto b = HttpLoggingServiceRegistry{}.serviceByName(config.className()).createInstance(config);
*this = b;
}
} // namespace cc