Skip to content
This repository has been archived by the owner on Dec 2, 2021. It is now read-only.

Commit

Permalink
Set the rialto log path from the settings file
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-collier committed Dec 3, 2018
1 parent 6eac404 commit 3c2f739
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
18 changes: 16 additions & 2 deletions lib/rialto/etl/logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,24 @@ module Logging

def logger
@logger ||= Yell.new do |logger|
logger.adapter :datefile, 'rialto_etl.log', level: 'lte.warn' # anything lower or equal to :warn
logger.adapter :datefile, 'rialto_etl_error.log', level: 'gte.error' # anything greater or equal to :error
logger.adapter :datefile, info_log, level: 'lte.warn' # anything lower or equal to :warn
logger.adapter :datefile, error_log, level: 'gte.error' # anything greater or equal to :error
end
end

private

def log_path
Settings.log_path || './log/'
end

def info_log
File.join(log_path, 'rialto_etl.log')
end

def error_log
File.join(log_path, 'rialto_etl_error.log')
end
end
end
end
Empty file added log/.gitkeep
Empty file.
17 changes: 17 additions & 0 deletions spec/rialto/logging_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

RSpec.describe Rialto::Etl::Logging do
include described_class

describe 'info_log' do
it 'provides a default path to the info log file' do
expect(info_log).to eq('./log/rialto_etl.log')
end
end

describe 'error_log' do
it 'provides a default path to the info log file' do
expect(error_log).to eq('./log/rialto_etl_error.log')
end
end
end

0 comments on commit 3c2f739

Please sign in to comment.