Class: LogStash::Logger
- Inherits:
-
Logger
- Object
- Logger
- LogStash::Logger
- Defined in:
- lib/logstash/logging.rb
Defined Under Namespace
Classes: Formatter
Instance Method Summary collapse
-
#initialize(*args) ⇒ Logger
constructor
A new instance of Logger.
- #level=(level) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Logger
Returns a new instance of Logger.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/logstash/logging.rb', line 17 def initialize(*args) super(*args) @formatter = LogStash::Logger::Formatter.new # Set default loglevel to WARN unless $DEBUG is set (run with 'ruby -d') self.level = $DEBUG ? Logger::DEBUG: Logger::INFO if ENV["LOGSTASH_DEBUG"] self.level = Logger::DEBUG end @formatter.progname = self.progname = File.basename($0) # Conditional support for awesome_print if !@@have_awesome_print && @@notify_awesome_print_load_failed debug [ "awesome_print not found, falling back to Object#inspect." \ "If you want prettier log output, run 'gem install "\ "awesome_print'", { :exception => @@notify_awesome_print_load_failed }] # Only show this once. @@notify_awesome_print_load_failed = nil end end |
Instance Method Details
#level=(level) ⇒ Object
42 43 44 45 |
# File 'lib/logstash/logging.rb', line 42 def level=(level) super(level) @formatter.level = level end |