Skip to content

Commit

Permalink
make logging output more detailed
Browse files Browse the repository at this point in the history
  • Loading branch information
wr0ngway committed Apr 30, 2021
1 parent 8b00c1d commit 7f17c8d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 4 additions & 1 deletion lib/kubetruth/cli.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
require_relative 'logging'
# Need to setup logging before loading any other files
Kubetruth::Logging.setup_logging(level: :info, color: false)

require_relative 'etl'
require 'clamp'

Expand Down Expand Up @@ -69,7 +72,7 @@ def parse(arguments)
level = :info
level = :debug if debug?
level = :error if quiet?
Logging.setup_logging(level: level, color: color?)
Kubetruth::Logging.setup_logging(level: level, color: color?)
end

def execute
Expand Down
5 changes: 2 additions & 3 deletions lib/kubetruth/logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,10 @@ def self.setup_logging(level: :info, color: true)

::Logging.logger.root.level = level
appenders = []
detail_pattern = '[%d] %-5l %c{2} %m\n'
plain_pattern = '%m\n'
detail_pattern = '[%d] %-5l %c{1} %m\n'

pattern_options = {
pattern: plain_pattern
pattern: detail_pattern
}
if color
pattern_options[:color_scheme] = 'bright'
Expand Down
3 changes: 3 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
require "bundler/setup"
require "kubetruth"
require "kubetruth/logging"
# Need to setup logging before loading any other files
Kubetruth::Logging.setup_logging(level: :info, color: false)

require "open3"

if ENV['CI']
Expand Down

0 comments on commit 7f17c8d

Please sign in to comment.