Loading lib/jsduck/logger.rb +21 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,27 @@ module JsDuck @shown_warnings = {} end # Configures the logger with command line options. def configure(opts) self.verbose = true if opts.verbose self.colors = opts.color unless opts.color.nil? # Enable all warnings except the following: set_warning(:all, true) set_warning(:link_auto, false) set_warning(:param_count, false) set_warning(:fires, false) set_warning(:nodoc, false) begin opts.warnings.each do |w| set_warning(w[:type], w[:enabled], w[:path], w[:params]) end rescue Warning::WarnException => e warn(nil, e.message) end end # Prints log message with optional filename appended def log(msg, filename=nil) if @verbose Loading lib/jsduck/options/parser.rb +7 −1 Original line number Diff line number Diff line require 'jsduck/options/helpful_parser' require 'jsduck/options/record' require 'jsduck/options/config' require 'jsduck/warning/parser' require 'jsduck/warning/warn_exception' require 'jsduck/logger' require 'jsduck/util/io' require 'jsduck/version' Loading Loading @@ -700,7 +702,11 @@ module JsDuck "(Those with '+' in front of them default to on)", "", *Logger.doc_warnings) do |warnings| @opts.warnings << warnings begin @opts.warnings += Warning::Parser.new(warnings).parse rescue Warning::WarnException => e Logger.warn(nil, e.message) end end @opts.attribute(:warnings_exit_nonzero, false) Loading lib/jsduck/options/processor.rb +1 −19 Original line number Diff line number Diff line Loading @@ -77,25 +77,7 @@ module JsDuck end def configure_logger Logger.verbose = true if @opts.verbose Logger.colors = @opts.color unless @opts.color.nil? # Enable all warnings except the following: Logger.set_warning(:all, true) Logger.set_warning(:link_auto, false) Logger.set_warning(:param_count, false) Logger.set_warning(:fires, false) Logger.set_warning(:nodoc, false) begin @opts.warnings.each do |warning| Warning::Parser.new(warning).parse.each do |w| Logger.set_warning(w[:type], w[:enabled], w[:path], w[:params]) end end rescue Warning::WarnException => e Logger.warn(nil, e.message) end Logger.configure(@opts) end # Turns multiprocessing off by default in Windows. Loading Loading
lib/jsduck/logger.rb +21 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,27 @@ module JsDuck @shown_warnings = {} end # Configures the logger with command line options. def configure(opts) self.verbose = true if opts.verbose self.colors = opts.color unless opts.color.nil? # Enable all warnings except the following: set_warning(:all, true) set_warning(:link_auto, false) set_warning(:param_count, false) set_warning(:fires, false) set_warning(:nodoc, false) begin opts.warnings.each do |w| set_warning(w[:type], w[:enabled], w[:path], w[:params]) end rescue Warning::WarnException => e warn(nil, e.message) end end # Prints log message with optional filename appended def log(msg, filename=nil) if @verbose Loading
lib/jsduck/options/parser.rb +7 −1 Original line number Diff line number Diff line require 'jsduck/options/helpful_parser' require 'jsduck/options/record' require 'jsduck/options/config' require 'jsduck/warning/parser' require 'jsduck/warning/warn_exception' require 'jsduck/logger' require 'jsduck/util/io' require 'jsduck/version' Loading Loading @@ -700,7 +702,11 @@ module JsDuck "(Those with '+' in front of them default to on)", "", *Logger.doc_warnings) do |warnings| @opts.warnings << warnings begin @opts.warnings += Warning::Parser.new(warnings).parse rescue Warning::WarnException => e Logger.warn(nil, e.message) end end @opts.attribute(:warnings_exit_nonzero, false) Loading
lib/jsduck/options/processor.rb +1 −19 Original line number Diff line number Diff line Loading @@ -77,25 +77,7 @@ module JsDuck end def configure_logger Logger.verbose = true if @opts.verbose Logger.colors = @opts.color unless @opts.color.nil? # Enable all warnings except the following: Logger.set_warning(:all, true) Logger.set_warning(:link_auto, false) Logger.set_warning(:param_count, false) Logger.set_warning(:fires, false) Logger.set_warning(:nodoc, false) begin @opts.warnings.each do |warning| Warning::Parser.new(warning).parse.each do |w| Logger.set_warning(w[:type], w[:enabled], w[:path], w[:params]) end end rescue Warning::WarnException => e Logger.warn(nil, e.message) end Logger.configure(@opts) end # Turns multiprocessing off by default in Windows. Loading