lib/cryptum/log.rb in cryptum-0.0.413 vs lib/cryptum/log.rb in cryptum-0.0.414
- old
+ new
@@ -22,12 +22,13 @@
# Define Date / Time Format
datetime_str = '%Y-%m-%d %H:%M:%S.%N%z'
# Always append to log file
- log_file = File.open('/tmp/cryptum.log', 'a')
- log_file = File.open("/tmp/cryptum-ai-#{session}-#{symbol}.json", 'a') if level == :learning
+ log_file_path = '/tmp/cryptum.log'
+ log_file_path = "/tmp/cryptum-ai-#{session}-#{symbol}.json" if level == :learning
+ log_file = File.open(log_file_path, 'a')
# Leave 10 "old" log files where
# each file is ~ 1,024,000 bytes
logger = Logger.new(
log_file,
@@ -40,15 +41,17 @@
when :debug
logger.level = Logger::DEBUG
when :error
exit_gracefully = true
logger.level = Logger::ERROR
+ puts "\nERROR: See #{log_file_path} for more details."
when :fatal
# This is reserved for the Cryptum::UI::Exit module
# if the Interrupt or StandardError exceptions are
# triggered. This prevents infintely attempting to
# exit if something in the module fails.
logger.level = Logger::FATAL
+ puts "\nFATAL ERROR: Event history cannot be saved. See #{log_file_path} for more details."
when :info, :learning
logger.level = Logger::INFO
when :unknown
logger.level = Logger::UNKNOWN
when :warn