Mentions légales du service

Skip to content
Snippets Groups Projects

Add a log formatter to print lines without decorators and remove passwords from logs

Merged Samir Noir requested to merge features/#13665 into master
Files
6
@@ -55,6 +55,10 @@ class Lanpower::Application::Lanpower < Lanpower::Application
:description => "Machine to work on",
:proc => nil #lambda { |v| puts "hello #{v}" }
# Options nowait and nocheck are not usable, this is due to a bug in mixlib-cli.
# When long options start with --no, they are negate.
# https://github.com/chef/mixlib-cli/issues/48
# https://intranet.grid5000.fr/bugzilla/show_bug.cgi?id=13673
option :nowait,
:short => "-n",
:long => "--no-wait",
@@ -73,6 +77,12 @@ class Lanpower::Application::Lanpower < Lanpower::Application
:description => "Configuration file to use (default: #{::Lanpower::CONFIG_FILE})",
:default => ::Lanpower::CONFIG_FILE
option :disable_log_decorators,
:long => "--disable-log-decorators",
:description => "Do not decorate log outputs, print message followed by datetime",
:boolean => true,
:default => false
def initialize
super
@nodes = Array.new
@@ -194,6 +204,7 @@ class Lanpower::Application::Lanpower < Lanpower::Application
#Ilanpower::Log.init("/var/log/ilanpower.log")
::Lanpower::Log.init() if config[:debug]
::Lanpower::Log.level(config[:debug] ? :debug : :info)
::Lanpower::Log.formatter = ::Lanpower::Log::NoDecoratorFormatter if config[:disable_log_decorators]
#Ilanpower::Log.level(:debug)
@conf = ::Lanpower::Config.new(config[:config])
if !config[:state] and config[:command].nil?
Loading