From b972289a3f6b6cd5379514482a1cf57d5a904807 Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Thu, 4 Jun 2020 01:44:50 +0200 Subject: [PATCH] light-control: fix log level --- configs/pepe/home-assistant/light-control.nix | 1 + modules/services/light-control.nix | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/configs/pepe/home-assistant/light-control.nix b/configs/pepe/home-assistant/light-control.nix index 6e2c47d..9e691ed 100644 --- a/configs/pepe/home-assistant/light-control.nix +++ b/configs/pepe/home-assistant/light-control.nix @@ -1,6 +1,7 @@ { pkgs, lib, config, ... }: { services.mqtt.light-control.enable = true; + services.mqtt.light-control.loglevel = "debug"; services.mqtt.light-control.config = { credentials = { host = "tcp://localhost:1883"; diff --git a/modules/services/light-control.nix b/modules/services/light-control.nix index 6a1b2ab..6d01dcc 100644 --- a/modules/services/light-control.nix +++ b/modules/services/light-control.nix @@ -32,6 +32,10 @@ in { options.services.mqtt.light-control = { enable = mkEnableOption "enable mqtt.light-control"; + loglevel = mkOption { + default = "info"; + type = with types; enum [ "info" "trace" "debug" "error" "warning" ]; + }; config = mkMagicMergeOption { description = "configuration of light-control"; }; }; @@ -39,7 +43,7 @@ in { config = mkIf cfg.enable { systemd.services."light-control" = { wantedBy = [ "multi-user.target" ]; - environment = { RUST_LOG = "light_control=trace"; }; + environment = { RUST_LOG = "light_control=${cfg.loglevel}"; }; script = '' ${pkgs.light-control}/bin/light-control ${lightControlConfig} '';