Don't set log level if not specified in config
If we set a default here, it doesn't allow setting the level in the environment variable.
This commit is contained in:
parent
45a3bb3c50
commit
f65a0f7fdc
@ -5,7 +5,6 @@ use config::{Config, InfluxDBConfig, MqttAuth, MqttConfig, UserAuth};
|
|||||||
use futures::TryFutureExt;
|
use futures::TryFutureExt;
|
||||||
use influxdb::InfluxDbWriteable;
|
use influxdb::InfluxDbWriteable;
|
||||||
use influxdb::{Client as InfluxClient, Timestamp, Type};
|
use influxdb::{Client as InfluxClient, Timestamp, Type};
|
||||||
use log::LevelFilter;
|
|
||||||
use mapping::{Mapping, Payload, TagValue, TopicLevel};
|
use mapping::{Mapping, Payload, TagValue, TopicLevel};
|
||||||
use rumqttc::{
|
use rumqttc::{
|
||||||
AsyncClient as MqttAsyncClient, Event, EventLoop as MqttEventLoop, Key, MqttOptions, Packet,
|
AsyncClient as MqttAsyncClient, Event, EventLoop as MqttEventLoop, Key, MqttOptions, Packet,
|
||||||
@ -253,9 +252,10 @@ async fn main() -> Result<(), String> {
|
|||||||
.filter("MQTT2DB_LOG")
|
.filter("MQTT2DB_LOG")
|
||||||
.write_style("MQTT2DB_LOG_STYLE");
|
.write_style("MQTT2DB_LOG_STYLE");
|
||||||
let mut logger_builder = env_logger::Builder::from_env(logger_env);
|
let mut logger_builder = env_logger::Builder::from_env(logger_env);
|
||||||
logger_builder
|
if let Some(log_level) = config.log_level {
|
||||||
.filter_level(config.log_level.unwrap_or(LevelFilter::Info))
|
logger_builder.filter_level(log_level);
|
||||||
.init();
|
}
|
||||||
|
logger_builder.init();
|
||||||
|
|
||||||
let mappings: Vec<Arc<Mapping>> = config
|
let mappings: Vec<Arc<Mapping>> = config
|
||||||
.mappings
|
.mappings
|
||||||
|
Loading…
Reference in New Issue
Block a user