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 influxdb::InfluxDbWriteable;
|
||||
use influxdb::{Client as InfluxClient, Timestamp, Type};
|
||||
use log::LevelFilter;
|
||||
use mapping::{Mapping, Payload, TagValue, TopicLevel};
|
||||
use rumqttc::{
|
||||
AsyncClient as MqttAsyncClient, Event, EventLoop as MqttEventLoop, Key, MqttOptions, Packet,
|
||||
@ -253,9 +252,10 @@ async fn main() -> Result<(), String> {
|
||||
.filter("MQTT2DB_LOG")
|
||||
.write_style("MQTT2DB_LOG_STYLE");
|
||||
let mut logger_builder = env_logger::Builder::from_env(logger_env);
|
||||
logger_builder
|
||||
.filter_level(config.log_level.unwrap_or(LevelFilter::Info))
|
||||
.init();
|
||||
if let Some(log_level) = config.log_level {
|
||||
logger_builder.filter_level(log_level);
|
||||
}
|
||||
logger_builder.init();
|
||||
|
||||
let mappings: Vec<Arc<Mapping>> = config
|
||||
.mappings
|
||||
|
Loading…
Reference in New Issue
Block a user