Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
dcdb
dcdb
Commits
0b5b37cc
Commit
0b5b37cc
authored
Feb 08, 2019
by
Micha Mueller
Browse files
Various fixes and improvements for printConfig feature
parent
9a431adc
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/dcdbpusher.cpp
View file @
0b5b37cc
...
...
@@ -330,6 +330,11 @@ int main(int argc, char** argv) {
LOG
(
info
)
<<
" MQTT-prefix: "
<<
pluginSettings
.
mqttPrefix
;
LOG
(
info
)
<<
" Write-Dir: "
<<
pluginSettings
.
tempdir
;
LOG
(
info
)
<<
" CacheInterval: "
<<
pluginSettings
.
cacheInterval
/
1000
<<
" [s]"
;
if
(
globalSettings
.
validateConfig
)
{
LOG
(
info
)
<<
" Only validating config files."
;
}
else
{
LOG
(
info
)
<<
" validateConfig: Disabled"
;
}
LOG
(
info
)
<<
"RestAPI Settings:"
;
LOG
(
info
)
<<
" REST Server: "
<<
restAPISettings
.
restHost
<<
":"
<<
restAPISettings
.
restPort
;
...
...
@@ -340,11 +345,6 @@ int main(int argc, char** argv) {
#else
LOG
(
info
)
<<
" Certificate, private key and DH-param file not printed."
;
#endif
if
(
globalSettings
.
validateConfig
)
{
LOG
(
info
)
<<
" Only validating config files."
;
}
else
{
LOG
(
info
)
<<
" validateConfig: Disabled"
;
}
for
(
auto
&
p
:
_configuration
->
getPlugins
())
{
LOG_VAR
(
vLogLevel
)
<<
"Plugin
\"
"
<<
p
.
id
<<
"
\"
"
;
...
...
src/includes/ConfiguratorTemplate.h
View file @
0b5b37cc
...
...
@@ -304,11 +304,13 @@ public:
return
readConfig
(
_cfgPath
);
}
/**
* Print configuration as read in.
*
* @param ll Logging level to log with
*/
void
printConfig
(
LOG_LEVEL
ll
)
final
{
LOG_VAR
(
ll
)
<<
" General: "
;
std
::
string
_mqttPrefix
;
std
::
string
_sensorPattern
;
unsigned
int
_cacheInterval
;
if
(
_mqttPrefix
!=
""
)
{
LOG_VAR
(
ll
)
<<
" MQTT-Prefix: "
<<
_mqttPrefix
;
}
else
{
...
...
@@ -318,13 +320,15 @@ public:
LOG_VAR
(
ll
)
<<
" Sensor Pattern: "
<<
_sensorPattern
;
}
if
(
_cacheInterval
!=
DEFAULT_CACHE_INTERVAL
)
{
LOG_VAR
(
ll
)
<<
" Cache interval: "
<<
_cacheInterval
;
LOG_VAR
(
ll
)
<<
" Cache interval: "
<<
_cacheInterval
<<
" ms"
;
}
else
{
LOG_VAR
(
ll
)
<<
" Cache interval: DEFAULT"
;
}
//prints plugin specific configurator attributes and entities if present
printConfiguratorConfig
(
ll
);
/*
LOG_VAR(ll) << " Entities (" << _entityName << "):";
if (_sensorEntitys.size() != 0) {
for(auto e : _sensorEntitys) {
...
...
@@ -332,11 +336,13 @@ public:
}
} else {
LOG_VAR(ll) << " No entities for this plugin";
}
}
*/
LOG_VAR
(
ll
)
<<
" Groups:"
;
for
(
auto
g
:
_sensorGroups
)
{
g
->
printConfig
();
g
->
SensorGroupInterface
::
printConfig
(
ll
);
g
->
printConfig
(
ll
);
g
->
SensorGroupTemplate
<
SBase
>::
printConfig
(
ll
);
}
}
...
...
@@ -630,7 +636,6 @@ protected:
LOG
(
debug
)
<<
" Using own MQTT-Prefix "
<<
_mqttPrefix
;
}
else
if
(
boost
::
iequals
(
global
.
first
,
"cacheInterval"
))
{
_cacheInterval
=
stoul
(
global
.
second
.
data
());
LOG
(
debug
)
<<
" Using own caching interval "
<<
_cacheInterval
<<
" [s]"
;
_cacheInterval
*=
1000
;
}
else
if
(
boost
::
iequals
(
global
.
first
,
"sensorpattern"
))
{
_sensorPattern
=
global
.
second
.
data
();
...
...
@@ -721,12 +726,13 @@ protected:
/**
* Print information about configurable configurator attributes (or nothing if no such attributes are required)
* and associated entities.
*
* @param ll Severity level to log with
*/
virtual
void
printConfiguratorConfig
(
LOG_LEVEL
ll
)
{
//Overwrite if necessary
LOG_VAR
(
ll
)
<<
" No other plugin specific general parameters"
;
LOG_VAR
(
ll
)
<<
" No other plugin specific general parameters
or entities defined
"
;
}
/**
...
...
src/includes/SensorBase.h
View file @
0b5b37cc
...
...
@@ -13,7 +13,7 @@
#include <string>
#include <limits.h>
#include <boost/lockfree/spsc_queue.hpp>
#include
<
Logging.h
>
#include
"
Logging.h
"
typedef
struct
{
int64_t
value
;
...
...
src/includes/SensorGroupInterface.h
View file @
0b5b37cc
...
...
@@ -81,6 +81,7 @@ public:
}
virtual
void
printConfig
(
LOG_LEVEL
ll
)
{
LOG_VAR
(
ll
)
<<
" Sensor Group "
<<
_groupName
;
if
(
_mqttPart
!=
""
)
{
LOG_VAR
(
ll
)
<<
" MQTT part: "
<<
_mqttPart
;
}
...
...
src/includes/SensorGroupTemplate.h
View file @
0b5b37cc
...
...
@@ -76,8 +76,7 @@ public:
}
virtual
void
printConfig
(
LOG_LEVEL
ll
)
override
{
SensorGroupInterface
::
printConfig
(
ll
);
LOG_VAR
(
ll
)
<<
" Sensors:"
;
for
(
auto
s
:
_sensors
)
{
s
->
SensorBase
::
printConfig
(
ll
,
lg
);
s
->
printConfig
(
ll
,
lg
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment