lib/log_repository_file.rb in RTALogger-1.0.0 vs lib/log_repository_file.rb in RTALogger-1.1.0
- old
+ new
@@ -5,12 +5,14 @@
module RTALogger
# show log items on console out put
class LogRepositoryFile < LogRepository
def initialize(file_path = 'log.txt', period = 'daily', shift_size = 1_048_576)
super()
- @file_logger = create_ruby_logger(file_path, period, shift_size)
- @formatter = RTALogger::LogFactory.log_formatter_default
+ @file_path = file_path
+ @period = period
+ @shift_size = shift_size
+ @file_logger = create_ruby_logger(@file_path, @period, @shift_size)
end
def load_config(config_json)
super
@@ -18,9 +20,18 @@
period = config_json['roll_period'].to_s
shift_size = config_json['roll_size'].nil? ? 1_048_576 : config_json['roll_size'].to_i
@file_logger = create_ruby_logger(file_path, period, shift_size)
end
+ def to_builder
+ json = super
+ json.enable enable
+ json.file_path @file_path
+ json.period @period
+ json.shift_size @shift_size
+
+ json
+ end
# register :file
protected
def create_ruby_logger(file_path, period, shift_size)