lib/hyla.rb in hyla-1.0.7.pre.7 vs lib/hyla.rb in hyla-1.0.7.pre.8

- old
+ new

@@ -20,11 +20,10 @@ require 'listen' require 'guard' require 'safe_yaml' require 'asciidoctor' require 'asciidoctor/backends/html5' -# require 'asciidoctor/backends/_stylesheets' # Added to fix issue with Ruby 2.0 on Windows machine require 'em/pure_ruby' require 'eventmachine' @@ -43,14 +42,35 @@ require 'hyla/core_ext' require 'hyla/command' require 'hyla/configuration' require 'hyla/websocket' require 'hyla/logger' +require 'hyla/logger2' # extensions require_all 'hyla/commands' module Hyla + def self.logger @logger ||= Logger.new + end + + def self.logger2 + log_cfg ||= $options[:log] + + hyla_cfg = safe_load_file($options[:config]) if $options[:config] + + mode ||= hyla_cfg['mode'] + dirname ||= hyla_cfg['dirname'] + logname ||= hyla_cfg['logname'] + level ||= hyla_cfg['level'] + tracer ||= hyla_cfg['tracer'] + + $logger2 ||= Logger2.new(mode, log_cfg, dirname, logname, level, tracer) + end + + def self.safe_load_file(filename) + f = File.expand_path(filename, $cmd_directory) + YAML.safe_load_file(f) end end \ No newline at end of file