logo

clairvoyance

Unnamed repository; edit this file 'description' to name the repository.
commit: f37c62655ca9e78555054e5de7fc808906b22d2f
parent: 8732423ac56a2c02ca6a39fb7d57758de2892886
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Tue, 11 Sep 2018 04:44:36 +0200

Add log configuration, append w/ "\n" by default

Diffstat:

Mconfig/config.exs4++++
Mlib/mix/tasks/scan.ex10++++++++--
2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/config/config.exs b/config/config.exs @@ -1,3 +1,7 @@ use Mix.Config # import_config "#{Mix.env()}.exs" + +config :clairvoyance, Clairvoyance.Log, + path: "/clairvoyance_scan.json", + modes: [:append] diff --git a/lib/mix/tasks/scan.ex b/lib/mix/tasks/scan.ex @@ -3,10 +3,16 @@ defmodule Mix.Tasks.Scan do def run(_) do Application.ensure_all_started(:clairvoyance) + settings = Application.get_env(:clairvoyance, Clairvoyance.Log) - result = Clairvoyance.scan() + result = + Clairvoyance.scan() |> Jason.encode!() - File.write("clairvoyance_scan.json", result) + File.write( + Keyword.get(settings, :path), + result <> "\n", + Keyword.get(settings, :modes) + ) end end